项目要求,main.js文件不在src根目录中,然后运行vue-cli-service serve时出现以下错误
* ./src/main.js in multi (webpack)-dev-server/client?http://10.0.68.112:8080/sockjs-node (webpack)/hot/dev-server.js ./src/main.js
文件目录 src-> server-> main.js
vue.config.js
const SkeletonWebpackPlugin = require('vue-skeleton-webpack-plugin') const path = require('path') module.exports = { outputDir: process.env.CLIENT_NAME === 'client' ? 'dist/client' : 'dist/server', configureWebpack: config => { if (process.env.CLIENT_NAME === 'client') { return { entry: { client: './src/client/main.js' }, plugins: [ new SkeletonWebpackPlugin({ webpackConfig: { entry: { client: path.join(__dirname, './src/client/entry-skeleton.js') }, output: { libraryTarget: 'commonjs2' } } }) ] } } else { return { entry: { server: './src/server/main.js' } } } } }
答案 0 :(得分:0)
npm install --save-dev babel-loader尝试