1,build/index.jscss
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.jshtml
new HtmlWebpackPlugin({
filename: 'inner-dmp/index.html',
template: 'index.html',
inject: true,
...
}複製代碼
build後輸入的文件目錄結構webpack
build裏面html文件引入資源文件路徑web