node.js - 错误- clean-webpack-plugin 只接受选项对象

标签 node.js reactjs heroku webpack deployment

每当我尝试将代码推送到 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/

相关文章:

node.js - 如何使用 Gulp 在不同文件夹中调用 Powershell 脚本

node.js - Node.js 中未定义 XSLTProcessor

javascript - Node js服务器。 http状态 - 404

javascript - 渲染后的 Preact 日志性能

node.js - Sequelize-CLI、Postgres、Heroku 生产 TypeError [ERR_INVALID_ARG_TYPE] : The "url" argument must be of type string. 接收类型未定义

javascript - 如何在本地主机或开发系统 Ubuntu 中运行 openshift MEAN 项目?

javascript - Json值NSDictionary转换

javascript - react router v4 不呈现任何其他路由

ruby-on-rails - Ruby on Rails Web 服务器

ruby-on-rails-3 - 如何在heroku上找到当前的连接池大小