compilation.getLogger 不是函数
compilation.getLogger is not a function
我将 copy-webpack-plugin
从 4.6.0
升级到 6.0.2
并且我更改了我的代码
plugins: [
new CopyWebpackPlugin([{
from: clientAssetPath,
to: paths.STATICS,
ignore: [ '.gitkeep' ],
}], {
debug: 'info'
}),
new HtmlWebpackPlugin({
...htmlPluginOptions,
}),
new DynamicCDNWebpackPlugin({
resolver: unpkgResolver,
}),
]
到
plugins: [
new CopyPlugin([{
patterns: [{
from: clientAssetPath,
to: paths.STATICS,
noErrorOnMissing: true
}]
}]),
new HtmlWebpackPlugin({
...htmlPluginOptions,
}),
new DynamicCDNWebpackPlugin({
resolver: unpkgResolver,
}),
]
所示
但它开始抛出以下错误:
compilation.getLogger is not a function
当我调试它时,我发现错误来自 node_modules/copy-webpack-plugin/dist/index.js
不知道是什么问题
还需要升级 webpack
https://github.com/webpack-contrib/copy-webpack-plugin/blob/master/package.json#L41
我可以通过以下两种方式解决问题
- 将
copy-webpack-plugin
降级到 5.1.1 并使用旧的构造函数解决了我的问题。
- 正在升级 web-pack 并解决由此引起的其他语法更改
我将 copy-webpack-plugin
从 4.6.0
升级到 6.0.2
并且我更改了我的代码
plugins: [
new CopyWebpackPlugin([{
from: clientAssetPath,
to: paths.STATICS,
ignore: [ '.gitkeep' ],
}], {
debug: 'info'
}),
new HtmlWebpackPlugin({
...htmlPluginOptions,
}),
new DynamicCDNWebpackPlugin({
resolver: unpkgResolver,
}),
]
到
plugins: [
new CopyPlugin([{
patterns: [{
from: clientAssetPath,
to: paths.STATICS,
noErrorOnMissing: true
}]
}]),
new HtmlWebpackPlugin({
...htmlPluginOptions,
}),
new DynamicCDNWebpackPlugin({
resolver: unpkgResolver,
}),
]
所示
但它开始抛出以下错误:
compilation.getLogger is not a function
当我调试它时,我发现错误来自 node_modules/copy-webpack-plugin/dist/index.js
还需要升级 webpack
https://github.com/webpack-contrib/copy-webpack-plugin/blob/master/package.json#L41
我可以通过以下两种方式解决问题
- 将
copy-webpack-plugin
降级到 5.1.1 并使用旧的构造函数解决了我的问题。 - 正在升级 web-pack 并解决由此引起的其他语法更改