1,build/index.js
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'), //建構輸出目錄 也就是建構後的東西都這裡
assetsSubDirectory: 'resources/dss-web-portal/inner-dmp/', //資源子目錄 除了index.html,其餘的js img css都分在這裡
assetsPublicPath: 'https://juejin.com/',
//cdnDomain: '/',
...
}複制代碼
2,webpack.prod.conf.js
new HtmlWebpackPlugin({
filename: 'inner-dmp/index.html',
template: 'index.html',
inject: true,
...
}複制代碼
build後輸入的檔案目錄結構
build裡面html檔案引入資源檔案路徑
轉載于:https://juejin.im/post/5cd9314fe51d453a8f348bf9