Skip to content

Vue-cli fails to build with polyfill #4313

Open
@stockersky

Description

@stockersky

Version

3.9.3

Environment info

  System:
    OS: Linux 5.1 Fedora 30 (Workstation Edition) 30 (Workstation Edition)
    CPU: (4) x64 Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz
  Binaries:
    Node: 10.16.0 - /usr/bin/node
    Yarn: Not Found
    npm: 6.9.0 - /usr/bin/npm
  Browsers:
    Chrome: 75.0.3770.142
    Firefox: 68.0
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0 
    @vue/babel-plugin-transform-vue-jsx:  1.0.0 
    @vue/babel-preset-app:  3.9.2 
    @vue/babel-preset-jsx:  1.0.0 
    @vue/babel-sugar-functional-vue:  1.0.0 
    @vue/babel-sugar-inject-h:  1.0.0 
    @vue/babel-sugar-v-model:  1.0.0 
    @vue/babel-sugar-v-on:  1.0.0 
    @vue/cli-overlay:  3.9.0 
    @vue/cli-plugin-babel: ^3.9.2 => 3.9.2 
    @vue/cli-plugin-eslint: ^3.9.2 => 3.9.2 
    @vue/cli-service: ^3.9.3 => 3.9.3 
    @vue/cli-shared-utils:  3.9.0 
    @vue/component-compiler-utils:  2.6.0 (3.0.0)
    @vue/preload-webpack-plugin:  1.1.0 
    @vue/web-component-wrapper:  1.2.0 
    eslint-plugin-vue: ^5.2.3 => 5.2.3 (4.7.1)
    vue: ^2.6.10 => 2.6.10 
    vue-analytics: ^5.17.0 => 5.17.0 
    vue-awesome-swiper: ^3.1.3 => 3.1.3 
    vue-carousel: ^0.18.0 => 0.18.0 
    vue-cli-plugin-vuetify: ^0.4.6 => 0.4.6 
    vue-cookie-law: ^1.10.0 => 1.10.0 
    vue-eslint-parser:  2.0.3 (5.0.0)
    vue-hot-reload-api:  2.3.3 
    vue-loader:  15.7.1 
    vue-loading-overlay: ^3.2.0 => 3.2.0 
    vue-router: ^3.0.7 => 3.0.7 
    vue-simple-spinner: ^1.2.8 => 1.2.8 
    vue-star-rating: ^1.6.1 => 1.6.1 
    vue-style-loader:  4.1.2 
    vue-swatches: ^1.0.3 => 1.0.3 
    vue-template-compiler: ^2.6.10 => 2.6.10 
    vue-template-es2015-compiler:  1.9.1 
    vue-wysiwyg: ^1.7.2 => 1.7.2 
    vue2-dropzone:  3.6.0 
    vuejs-datepicker: ^1.6.2 => 1.6.2 
    vuetify: ^1.5.16 => 1.5.16 
    vuetify-loader: ^1.2.2 => 1.2.2 
    vuex: ^3.1.1 => 3.1.1 
    vuex-persist: ^2.0.1 => 2.0.1 
  npmGlobalPackages:
    @vue/cli: 3.9.3

Link to minimal reproduction

https://github.com/stockersky/test-app

Steps to reproduce

npm run build

What is expected?

Vuejs / Vuetify app should be built with polyfill in order to support older browsers.

For testing purpose, I use pre ES2015 opera browser version 15 and put it on .browserslistrc which looks like this:

> 1%
last 2 versions
not ie <= 8
Chrome >= 41
Opera >= 15

I also noticed that throught the url inspector in Google Search Console, the page is blank, html code is the one of the public/index.html file and Uncaught SyntaxError: Unexpected reserved word is raised.

I'd expect Google bot to be able to "boot" my SPA app. This actually this which led me to try to generate polyfills.

What is actually happening?

 ERROR  Failed to compile with 122 errors                                                                             10:18:46 PM

These dependencies were not found:

* core-js/modules/es6.array.copy-within in ./src/main.js
* core-js/modules/es6.array.fill in ./src/main.js
* core-js/modules/es6.array.find in ./src/main.js
* core-js/modules/es6.array.find-index in ./src/main.js
* core-js/modules/es6.array.from in ./src/main.js
* core-js/modules/es6.array.iterator in ./src/main.js
* core-js/modules/es6.array.of in ./src/main.js
* core-js/modules/es6.array.sort in ./src/main.js
* core-js/modules/es6.array.species in ./src/main.js
....................................................................................................
To install them, you can run: npm install --save core-js/modules/es6.array.copy-within core-js/modules/es6.array.fill core-js/modules/es6.array.find core-js/modules/es6.array.find-index core-js/modules/es6.array.from core-js/modules/es6.array.iterator core-js/modules/es6.array.of core-js/modules/es6.array.sort core-js/modules/es6.array.species core-js/modules/es6.date.to-primitive core-js/modules/es6.function.has-instance core-js/modules/es6.function.name core-js/modules/es6.map core-js/modules/es6.math.acosh core-js/modules/es6.math.asinh 

Here is my babel.config.js :

const removeConsolePlugin = [];
if(process.env.NODE_ENV === 'production') {
  removeConsolePlugin.push("transform-remove-console");
}

module.exports = {
  presets: [
    ["@vue/app", {
      useBuiltIns: "entry",
      debug: true,
    }],
  ],
  plugins: removeConsolePlugin
};

Top of my main.js :

import '@babel/polyfill';

NOTE : if i try:

module.exports = {
  presets: [
    ["@babel/preset-env", {
      useBuiltIns: "entry",
      debug: true,
    }],
  ],

I get:

Using polyfills with `entry` option:

[/PROJECTS/CODE/cv-app/node_modules/vuetify/lib/components/VApp/index.js] `import '@babel/polyfill'` was not found.
⠏  Building for production...
[/PROJECTS/CODE/cv-app/node_modules/vuetify/lib/components/VWindow/index.js] `import '@babel/polyfill'` was not found.

[/PROJECTS/CODE/cv-app/node_modules/vuetify/lib/components/transitions/index.js] `import '@babel/polyfill'` was not found.

[/PROJECTS/CODE/cv-app/node_modules/vuetify/lib/components/VTooltip/index.js] `import '@babel/polyfill'` was not found.

[/PROJECTS/CODE/cv-app/node_modules/vuetify/lib/components/VTimeline/index.js] `import '@babel/polyfill'` was not found.
.................................................................................................................................................

Please help !!!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs team reproWe acknowledged your report and will soon try to reproduce it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions