专业的编程技术博客社区

网站首页 > 博客文章 正文

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

baijin 2024-08-21 11:17:38 博客文章 5 ℃ 0 评论

问题描述

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

(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

问题分析

看官网也有这个问题,extract-text-webpack-plugin还不能支持webpack4.0.0以上的版本。有个这样的描述

既然出现这个问题了,那基本上你用的webpack版本一定是4.0.0以上的了。

查看下package.json里

"devDependencies": {
 ...
 "extract-text-webpack-plugin": "^3.0.2",
 "html-webpack-plugin": "^3.2.0",
 "postcss-loader": "^2.1.4",
 "style-loader": "^0.21.0",
 "webpack": "^4.6.0",
 ...
 },

解决办法

npm install --save-dev extract-text-webpack-plugin@next

会下载到+ extract-text-webpack-plugin@4.0.0-beta.0

然后在打包就正常了

"devDependencies": {
 ...
 "extract-text-webpack-plugin": "^4.0.0-beta.0",
 "html-webpack-plugin": "^3.2.0",
 "postcss-loader": "^2.1.4",
 "style-loader": "^0.21.0",
 "webpack": "^4.6.0",
 ...
 }

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表