Webpack中publicPath設置


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/'
},

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM