There is an issue with an error in the extension operator in the vue third-party library
A previous article said that the es6 extension (...) syntax is used in vue, and then the compilation keeps reporting errors unExpected token
Solution
1. Introduce babel dependencies
npm install babel-plugin-transform-object-rest-spread npm install babel-preset-es2015 --save-dev
2. Modify it in the src/.babelrc file of the vue project (not created by yourself)
{ "presets":[["es2015",{"modules":false}]],//Rely on ES5 module conversion"plugins":["transform-object-rest-spread"] }
But there is a problem that if there is an extension operator in the third-party library I introduced, this error will still exist.
Solution:
Need to be inAdded in
resolve('Path to third-party library')
Previous configuration:
test: /\.(js)$/, loader: 'babel-loader', options: { //plugins:['syntax-dynamic-import'], presets: ['es2015'] }, include: [resolve('src')] }
After modification:
test: /\.(js)$/, loader: 'babel-loader', options: { //plugins:['syntax-dynamic-import'], presets: ['es2015'] }, include: [resolve('src'),resolve('node_modules/webpack-dev-server/client'),resolve('node_modules/bootstrap/dist/js/')] }
node_modules/bootstrap/dist/js/ is the file that reports an error
This is the article about the problem of the extension operator error in the vue third-party library. For more information about the extension operator error in the vue third-party library, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!