【问题标题】:Error- clean-webpack-plugin only accepts an options object错误 - clean-webpack-plugin 仅接受选项对象
【发布时间】:2019-11-10 23:44:15
【问题描述】:

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

【问题讨论】:

    标签: node.js reactjs heroku webpack deployment


    【解决方案1】:

    看起来您正在使用旧配置和新插件版本。检查upgrade information

    如果使用基本配置 new CleanWebpackPlugin(['dist']),只需删除 ['dist'] 一切都会按预期进行。否则读 仔细看下面。

    【讨论】:

    • 我阅读了官方文档并且已经删除了 ['dist'] 没有任何改变仍然得到同样的错误
    • rootexclude 选项已过时
    • 我必须将我的代码转换为新版本,但问题是如何?
    猜你喜欢
    • 2019-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-18
    • 1970-01-01
    • 2019-07-08
    相关资源
    最近更新 更多