This plugin is supposed to solve the problematic thing which is inability to change publicPath for css files only when lazy loading them using MiniCssExtractPlugin
.
Tested only with Webpack@4.28.4
and MiniCssExtractPlugin@0.8.0
but should be comapitible with any Webpack@4.x
.
Please bear in mind that this plugin heavily relies on code generated by MiniCssExtractPlugin. If the code responsible for lazy loading css chunks changes, this plugin would probably stop working till next update.
config.plugins = [
new CustomPublicPath({
cssPublicPath: function doPath(href, webpackPublicPath) {
return 'custom/path/to/lazy/css/' + href;
}
})
];
config.plugins = [
new CustomPublicPath({
cssPublicPath: 'custom/path/'
})
];