Webpack中publicPath设置

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

webpack中的publicPath是咱们打算放到web服务器下的目录,若是咱们要放到网站的根目录下,那么就无需设置。若是要放到站点的其它路径,就能够经过设置publicPath来实现。webpack

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

output: {
path: helpers.root('dist'),
filename: '[name].[chunkhash].bundle.js',
sourceMapFilename: '[name].[chunkhash].bundle.map',
chunkFilename: '[id].[chunkhash].chunk.js',
publicPath: '/front/'
},
相关文章
相关标签/搜索