目前现象:使用html-webpack-plugin和extract-text-webpack-plugin生成html中自动插入的link地址和extract-text-webpack-plugin设置的filename一致
<link href="index/css/style.css" rel="stylesheet"></head>
new exTxt({
filename:'[name]/css/style.css'
}),
new htmlWebpackPlugin({
filename:path.resolve(pathConfig.dist,`./${app}/index.html`),
template:path.resolve(pathConfig.apps,`./${app}/page.js`),
inject:"body",
minify: {
// removeComments: true,
// collapseWhitespace: true,
// removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
chunks:[app,'commons/commons']
});
目的:正确地址应该是css/style.css,有哪位大神告诉我怎么修改啊
官网上有这一步
plugins: [
new ExtractTextPlugin({
filename: (getPath) => {
return getPath('css/[name].css').replace('css/js', 'css');
},
allChunks: true
})
]
但是我试了报错,提示filename必须是string