survivejs / webpack-book

From apprentice to master (CC BY-NC-ND)
https://survivejs.com/webpack/
2.42k stars 319 forks source link

building - tidying up - CleanWebpackPlugin@3.0.0 replace default export with named export #317

Closed liuzhuan closed 4 years ago

liuzhuan commented 5 years ago

If we install the latest clean-webpack-plugin, which is v3.0.0 now. And we require its default export, such as:

const CleanWebpackPlugin = require("clean-webpack-plugin");

We would get a error:

TypeError: HtmlWebpackPlugin is not a constructor
...

Because the default export has been replaced with named export in this commit.

So we should change the require method a little, just for v3.0.0+:

const { CleanWebpackPlugin } = require("clean-webpack-plugin");
bebraw commented 5 years ago

Thanks, I'll fix for the next revision.

bebraw commented 4 years ago

Done at dev. Sorry for the delay!