每当我尝试将代码推送到 heroku 时都会收到此错误。有什么解决办法吗?
new CleanWebpackPlugin(['dist'], {
root: path.resolve(__dirname, '..'),
exclude: '.gitignore'
})
错误:clean-webpack-plugin 只接受选项对象。请参阅:
remote: https://github.com/johnagan/clean-webpack-plugin#options-and-
defaults-optional
remote: at new CleanWebpackPlugin
(/tmp/build_292ba470efc2cc3ad6c89a8c22c708c9/node_modules/clean-webpack-
plugin/dist/clean-webpack-plugin.js:17:13)
remote: at Object.<anonymous>
(/tmp/build_292ba470efc2cc3ad6c89a8c22c708c9/webpack/prod.config.js:90:5)
remote: at Module._compile
(/tmp/build_292ba470efc2cc3ad6c89a8c22c708c9/node_modules/v8-compile-
cache/v8-compile-cache.js:192:30)
remote:at Object.Module._extensions..js (internal/modules/cjs/loader.js:7
最佳答案
看起来您正在使用旧的配置和较新的插件版本。检查upgrade information :
If using basic config new CleanWebpackPlugin(['dist']), simply remove ['dist'] and everything will work as expected. Otherwise read carefully below.
关于node.js - 错误- clean-webpack-plugin 只接受选项对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56816676/