[webpack] Configuration Error: Avoid modifying webpack output.publicPath directly. Use the "publicPath" option instead.

 

需求

vue-cli脚手架生成的项目,想要配置webpack下的output.publicPath选项

 

配置1

module.exports = {

    configureWebpack: {

        publicPath: ‘http://localhost:8080/‘,

    }

  }

 

报错

configuration has an unknown property ‘publicPath‘. These properties are valid: output?

理解:需要在output下配置

 

配置2

module.exports = {

    configureWebpack: {

      output: {

        publicPath: ‘http://localhost:8080/‘,

    },

    }

  }

报错:

Configuration Error: Avoid modifying webpack output.publicPath directly. Use the "publicPath" option instead.

理解:不要将publicPath配置在Output下

 

这....

 

解决

查vue-cli文档发现,publicPath可以无需配置在configureWebpack这个下

module.exports = {
  publicPath: ‘http://localhost:8080/‘
}
 

 

 

 

[webpack] Configuration Error: Avoid modifying webpack output.publicPath directly. Use the "publicPath" option instead.

上一篇:jsp04


下一篇:.net Lamda表达式