【发布时间】:2022-01-14 19:53:37
【问题描述】:
vue cli 有一些问题。当我运行 npm run serve 时,一切都很顺利。当我进入开发模式时,npm run build-dev,构建过程完成。我有一个空白页。
错误信息是“Uncaught SyntaxError: Unexpected token '
以下是我的设置: 打包.json
{
"name": "gold",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"test:unit": "vue-cli-service test:unit",
"lint": "vue-cli-service lint",
"build-dev": "vue-cli-service build --mode production-dev",
"build-production": "vue-cli-service build"
},
"dependencies": {
"axios": "^0.21.1",
"babel-polyfill": "^6.26.0",
"camelize2": "^1.0.0",
"core-js": "^3.6.5",
"element-ui": "^2.15.5",
"vue": "^2.6.14",
"vue-carousel": "^0.18.0",
"vue-router": "^3.2.0",
"vuex": "^3.4.0"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-unit-jest": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/eslint-config-standard": "^5.1.2",
"@vue/test-utils": "^1.0.3",
"babel-eslint": "^10.1.0",
"babel-plugin-component": "^1.1.1",
"eslint": "^6.8.0",
"eslint-plugin-import": "^2.20.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-standard": "^4.0.0",
"eslint-plugin-vue": "^6.2.2",
"sass": "^1.26.5",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.14",
"webpack-bundle-analyzer": "^3.9.0"
}
}
vue.config.js
// const BundleAnalyzerPlugin = require('webpack-bundle-analyzer')
// .BundleAnalyzerPlugin
module.exports = {
// options...
// configureWebpack: {
// plugins: [new BundleAnalyzerPlugin()]
// },
// configureWebpack: {
// optimization: {
// runtimeChunk: 'single',
// splitChunks: {
// chunks: 'all',
// maxInitialRequests: Infinity,
// minSize: 0,
// cacheGroups: {
// vendor: {
// test: /[\\/]node_modules[\\/]/,
// name(module) {
// // get the name. E.g. node_modules/packageName/not/this/part.js
// // or node_modules/packageName
// const packageName = module.context.match(
// /[\\/]node_modules[\\/](.*?)([\\/]|$)/
// )[1]
// // npm package names are URL-safe, but some servers don't like @ symbols
// return `npm.${packageName.replace('@', '')}`
// }
// }
// }
// }
// }
// },
devServer: {
port: 8989
},
transpileDependencies: ['camelcase']
}
抱歉,如果我不能显示任何进一步的代码,谢谢。
【问题讨论】:
标签: javascript node.js vue.js npm