最近使用webpack打包时,报了一个extract-text-webpack-plugin的错误,查找了一下,原来是extract-text-webpack-plugin还不能支持webpack4.0.0以上的版本。在package.json里面看下,果然我使用的webpack版本是v4.16.3,extract-text-webpack-plugin默认安装到的版本是v3.0.2
报错信息:
(node:12712) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
E:\***\myproject\webpack-vue-elementUi\node_modules\webpack\lib\Chunk.js:460
throw new Error(
^
Error: Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead
at Chunk.get (E:\***\myproject\webpack-vue-elementUi\node_modules\webpack\lib\Chunk.js:460:9)
at E:\***\myproject\webpack-vue-elementUi\node_modules\extract-text-webpack-plugin\dist\index.js:176:48
at Array.forEach (<anonymous>)
at E:\***\myproject\webpack-vue-elementUi\node_modules\extract-text-webpack-plugin\dist\index.js:171:18
解决方法:
npm install --save-dev extract-text-webpack-plugin@next
会下载到 extract-text-webpack-plugin@4.0.0-beta
然后再打包就OK了~