webpack中的path是当我们build的时候,输出项目打包文件的位置。

webpack中的publicPath是我们打算放到web服务器下的目录,如果我们要放到网站的根目录下,那么就无需设置。如果要放到站点的其它路径,就可以通过设置publicPath来实现。

这样当运行的时候,请求的其它js, css等资源,就会添加上这个路径。

output: {
path: helpers.root('dist'),
filename: '[name].[chunkhash].bundle.js',
sourceMapFilename: '[name].[chunkhash].bundle.map',
chunkFilename: '[id].[chunkhash].chunk.js',
publicPath: '/front/'
},

 

相关文章:

  • 2022-12-23
  • 2021-12-02
  • 2021-06-11
  • 2021-06-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-01
  • 2022-12-23
  • 2022-12-23
  • 2021-10-15
  • 2021-09-09
  • 2021-07-23
相关资源
相似解决方案