vue-cli: core-js module error
Version
3.5.1
Environment info
mac os 10.14.3
Steps to reproduce
vue-cli-service serve --mode development
What is expected?
run the project correctly
What is actually happening?
With useBuiltIns option, required direct setting of corejs option 98% after emitting CopyPlugin ERROR Failed to compile with 36 errors 10:20:25 These dependencies were not found:
core-js/modules/es6.array.iterator in ./src/main.js, ./src/webapp/main.js core-js/modules/es6.function.name in ./src/main.js core-js/modules/es6.number.constructor in ./src/assets/js/utils.js core-js/modules/es6.object.assign in ./src/main.js, ./src/webapp/main.js core-js/modules/es6.object.to-string in ./src/main.js, ./src/assets/js/utils.js and 2 others core-js/modules/es6.promise in ./src/main.js, ./src/webapp/main.js core-js/modules/es6.regexp.match in ./src/assets/js/utils.js core-js/modules/es6.regexp.replace in ./src/main.js, ./src/assets/js/gt.js and 3 others core-js/modules/es6.regexp.split in ./src/assets/js/utils.js core-js/modules/es6.regexp.to-string in ./src/main.js, ./src/assets/js/utils.js and 1 other core-js/modules/es6.string.includes in ./src/store.js, ./src/main.js and 2 others core-js/modules/es6.string.iterator in ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref–12-0!./node_modules/_babel-loader@8.0.5@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref–0-0!./node_modules/_vue-loader@15.7.0@vue-loader/lib??vue-loader-options!./src/views/assets/Index.vue?vue&type=script&lang=js& core-js/modules/es6.typed.uint8-array in ./src/assets/js/utils.js core-js/modules/es7.array.includes in ./src/store.js, ./src/main.js and 3 others core-js/modules/es7.promise.finally in ./src/main.js, ./src/webapp/main.js core-js/modules/web.dom.iterable in ./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref–12-0!./node_modules/_babel-loader@8.0.5@babel-loader/lib!./node_modules/_cache-loader@2.0.1@cache-loader/dist/cjs.js??ref–0-0!./node_modules/_vue-loader@15.7.0@vue-loader/lib??vue-loader-options!./src/views/assets/Index.vue?vue&type=script&lang=js&
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 57
- Comments: 30 (2 by maintainers)
Commits related to this issue
- fix: use absolute import path for injected core-js polyfills fixes #3678 — committed to sodatea/vue-cli by sodatea 5 years ago
- fix: use absolute import path for injected core-js polyfills (#3710) fixes #3678 — committed to vuejs/vue-cli by sodatea 5 years ago
- Attempt to fix Travis CI issue. Based on https://github.com/vuejs/vue-cli/issues/3678#issuecomment-474728989 — committed to phyloref/open-tree-resolver by gaurav 5 years ago
- Update babel config to support split Long story short: the issue was that the system (for lack of a better word) was looking for files that were prefixed with es6... whereas my core-js files were pre... — committed to Armitage35/fuzzy-roadmap by Armitage35 5 years ago
- Import user Roadmap (#59) * v0.7.0 * Boilerplate for CSV roadmap import * Add style and hints * Boilerplate interaction * Wait what? * Update babel config to support split Long stor... — committed to Armitage35/fuzzy-roadmap by Armitage35 5 years ago
- Release/v1.2.3 (#70) * nitckpick boilerplate * Add license * Update issue templates * Add shields to readme Mention maintenance, license and that we use vue.js * Set up component boile... — committed to Armitage35/fuzzy-roadmap by Armitage35 5 years ago
- Release/v2.0.0 (#80) * nitckpick boilerplate * Add license * Update issue templates * Add shields to readme Mention maintenance, license and that we use vue.js * Set up component boile... — committed to Armitage35/fuzzy-roadmap by Armitage35 5 years ago
- Release/v2.1.0 (#83) * nitckpick boilerplate * Add license * Update issue templates * Add shields to readme Mention maintenance, license and that we use vue.js * Set up component boile... — committed to Armitage35/fuzzy-roadmap by Armitage35 5 years ago
- Release/v2.3.0 (#87) * nitckpick boilerplate * Add license * Update issue templates * Add shields to readme Mention maintenance, license and that we use vue.js * Set up component boile... — committed to Armitage35/fuzzy-roadmap by Armitage35 5 years ago
- Release/v2.4.0 (#90) * nitckpick boilerplate * Add license * Update issue templates * Add shields to readme Mention maintenance, license and that we use vue.js * Set up component boile... — committed to Armitage35/fuzzy-roadmap by Armitage35 5 years ago
- Update project deps Includes updates to babel config else build breaks See for more info: https://github.com/vuejs/vue-cli/issues/3678 — committed to callumflack/replier by barryph 5 years ago
- v2.5.0 (#96) * Deploy V1 (#61) * nitckpick boilerplate * Add license * Update issue templates * Add shields to readme Mention maintenance, license and that we use vue.js * Set up co... — committed to Armitage35/fuzzy-roadmap by Armitage35 5 years ago
- Release/v2.5.0 (#97) * nitckpick boilerplate * Add license * Update issue templates * Add shields to readme Mention maintenance, license and that we use vue.js * Set up component boile... — committed to Armitage35/fuzzy-roadmap by Armitage35 5 years ago
- Fixing a dependency issue: https://github.com/vuejs/vue-cli/issues/3678 — committed to ZenUml/confluence-plugin-cloud by MrCoder 4 years ago
babel.config.js
presets: [ [ "@vue/app", { useBuiltIns: "entry" } ] ]
This is reason: https://babeljs.io/docs/en/babel-preset-env#usebuiltins
So you can set: presets: [ [ “@vue/app”, { useBuiltIns: “entry” } ] ].
More important, you must set polyfills in code. ref: https://cli.vuejs.org/guide/browser-compatibility.html#usebuiltins-usage
I solve it by
npm install --save core-js
note my Vue Cli versionvue -V 3.9.2
Solved by:
I try this, it works. why?
@dxc-jbeck please install core-js@2 rather than 3.
I think the reason is that the core-js is updated to version 3, in this version it removes these file: ‘core-js/modules/es6.array.iterator’, but the @babel/preset-env still generate these code: import “core-js/modules/es6.array.iterator”. So It leads to the errors in the topic
solve
Para el template Light Bootstrap Dashboard de VUE, debes realizar esta configuracion en el archivo .babelrc
"useBuiltIns": "entry"
El archivo quedaria asi
{ "presets": [ [ "@vue/app", { "polyfills": ["es7.object.entries", "es6.promise"], "useBuiltIns": "entry" } ] ] }
Fixed in 3.5.2
yeah, if we want use core-js 3.0, we need change our babel config like this:
or
as our old configuration, we didn’t config the corejs version, it will adopt the corejs@2 default. But the @babel/preset-env 7.4.0 has the dependency of corejs-3.0. so it leads to these ‘not found’ errors. I think the
@babel/preset-env
also needs to add the dependency of corejs@2 to the package.json.Another way to solve this if you don’t want to change the babelrc configuration, it is to install corejs@2 at the top of our dependency. just one command at your current project:
npm i corejs@2
@sodatea thank you it’s working with core-js 2.65 and this in main.js
This can solve my problem