TypeError: CleanwebpackPlugin is not a constructor

前端 未结 10 2134
感动是毒
感动是毒 2021-01-01 08:39

i\'m trying to preview a vue web application through webpack-server-dev.I\'m following this guide https://medium.com/the-web-tub/creating-your-first-vue-js-pwa-project-22f7

10条回答
  •  忘掉有多难
    2021-01-01 09:06

    I had the same issue today, right now. As you can tell, there was a mismatch between the docs and the actual code. And in fact, you can see in the last commit they merged both to the documentation:

    and also to the code:

    So I just switched from const CleanWebpackPlugin = require('clean-webpack-plugin') to

    const { CleanWebpackPlugin } = require('clean-webpack-plugin');
    

    and it works fine.

    I think you may have been caught in between things. Reinstall the npm package and try again, it should work.

    I wrote a bit of what you can see in their public repository because very often when sudden changes like this happen, you'll find your own answer in the repo, probably in the last commits. And it's good reading a bit of the code you use, especially if it helps you troubleshoot your issue :)

提交回复
热议问题