7
votes

Project requirements, The main.js file is not in the src root directory, and then run vue-cli-service serve has the following error


    * ./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

File Directory 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'
            }
          }
        }
      }
    }

1

1 Answers

-1
votes

npm install --save-dev babel-loader try this