webpack使用extract-text-webpack-plugin打包时提示错误

最近使用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 ()
        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

会下载到 [email protected]

然后再打包就OK了~

你可能感兴趣的:(webpack)