I have some problem with vue cli. When I run npm run serve everything went smooth. When I go for dev mode, npm run build-dev, the build process completed. I got a blank page.
The error message is “Uncaught SyntaxError: Unexpected token ‘<‘”
Below is my setup:
pacakge.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']
}
Sorry before if I can not show any further code, thanks.