項目打包時出現了這種問題,說是core-js的包出了問題,但是我根本沒有用它啊。
These dependencies were not found: * core-js/fn/array/flat-map in ./node_modules/@babel/polyfill/lib/noConflict.js * core-js/fn/promise/finally in ./node_modules/@babel/polyfill/lib/noConflict.js * core-js/fn/string/pad-end in ./node_modules/@babel/polyfill/lib/noConflict.js * core-js/fn/string/pad-start in ./node_modules/@babel/polyfill/lib/noConflict.js * core-js/fn/string/trim-end in ./node_modules/@babel/polyfill/lib/noConflict.js * core-js/fn/string/trim-start in ./node_modules/@babel/polyfill/lib/noConflict.js * core-js/fn/symbol/async-iterator in ./node_modules/@babel/polyfill/lib/noConflict.js * core-js/library/fn/array/is-array in ./node_modules/@babel/runtime-corejs2/core-js/array/is-array.js * core-js/library/fn/global in ./node_modules/@babel/polyfill/lib/index.js * core-js/library/fn/parse-float in ./node_modules/@babel/runtime-corejs2/core-js/parse-float.js * core-js/library/fn/parse-int in ./node_modules/@babel/runtime-corejs2/core-js/parse-int.js To install them, you can run: npm install --save core-js/fn/array/flat-map core-js/fn/promise/finally core-js/fn/string/pad-end core-js/fn/string/pad-start core-js/fn/string/trim-end core-js/fn/string/trim-start core-js/fn/symbol/async-iterator core-js/library/fn/array/is-array core-js/library/fn/global core-js/library/fn/parse-float core-js/library/fn/parse-int............
總之就是讓你安裝與core-js相關的東西。
解決方法:
在babel.config.js中添加:
presets: [ [ "@vue/app", { useBuiltIns: "entry" } ] ]
簡單解決
