错误-clean-webpack-plugin仅接受选项对象

时间:2019-06-29 10:09:59

标签: 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

1 个答案:

答案 0 :(得分:0)

您似乎正在使用具有较新插件版本的旧配置。检查upgrade information

  

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