I upgraded copy-webpack-plugin
from 4.6.0
to 6.0.2
and I changed my code from
plugins: [
new CopyWebpackPlugin([{
from: clientAssetPath,
to: paths.STATICS,
ignore: [ '.gitkeep' ],
}], {
debug: 'info'
}),
new HtmlWebpackPlugin({
...htmlPluginOptions,
}),
new DynamicCDNWebpackPlugin({
resolver: unpkgResolver,
}),
]
to
plugins: [
new CopyPlugin([{
patterns: [{
from: clientAssetPath,
to: paths.STATICS,
noErrorOnMissing: true
}]
}]),
new HtmlWebpackPlugin({
...htmlPluginOptions,
}),
new DynamicCDNWebpackPlugin({
resolver: unpkgResolver,
}),
]
as given on official website
But it started throwing following error:
compilation.getLogger is not a function
When I debugged it I found error is coming from node_modules/copy-webpack-plugin/dist/index.js
don't know what is the problem
It needs upgrade of webpack
as well https://github.com/webpack-contrib/copy-webpack-plugin/blob/master/package.json#L41
I could be able to fix the problem in following two ways
copy-webpack-plugin
to 5.1.1 and using the old constructor fixes the issue for me.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With