webpack4.0以上太难了....

我刚入门webpack就被版本问题坑一脸,以此第一篇博客记录一下我踩过的坑~~~

1.报错:Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.

- configuration has an unknown property ‘mode‘. These properties are valid:

解决:Webpack4以上要声明mode:‘development‘,4以下版本不用

2.运行webpack-dev-server时报错:Error: Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead

解决:extract-text-webpack-plugin还不能支持webpack4.0.0以上的版本,将Webpack版本将至3,全局卸载webpack:npm uninstall webpack -g,最好将node_modules文件一起删除,避免卸载残留影响低版本安装。

3.还有在实用plugin时一定要带s!!!

能记起来的就这么多啦~~之后再想到的再补充吧~~

相关推荐