首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Chunk.entrypoints:用Chunks.groupsIterable和filter代替Entrypoint

Chunk.entrypoints:用Chunks.groupsIterable和filter代替Entrypoint
EN

Stack Overflow用户
提问于 2018-07-17 14:12:23
回答 4查看 66.4K关注 0票数 97

当我试图启动我的应用程序时,我看到了以下错误.

代码语言:javascript
复制
> css-modules@1.0.0 start /Users/johnnynolan/Repos/css-modules

webpack &开放index.html

代码语言:javascript
复制
(node:5706) DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead
/Users/johnnynolan/Repos/css-modules/node_modules/webpack/lib/Chunk.js:802
        throw new Error(
        ^

Error: Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead
    at Chunk.get (/Users/johnnynolan/Repos/css-modules/node_modules/webpack/lib/Chunk.js:802:9)
    at /Users/johnnynolan/Repos/css-modules/node_modules/extract-text-webpack-plugin/dist/index.js:176:48
    at Array.forEach (<anonymous>)
    at /Users/johnnynolan/Repos/css-modules/node_modules/extract-text-webpack-plugin/dist/index.js:171:18
    at AsyncSeriesHook.eval [as callAsync] (eval at create (/Users/johnnynolan/Repos/css-modules/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:7:1)
    at AsyncSeriesHook.lazyCompileHook [as _callAsync] (/Users/johnnynolan/Repos/css-modules/node_modules/tapable/lib/Hook.js:35:21)
    at Compilation.seal (/Users/johnnynolan/Repos/css-modules/node_modules/webpack/lib/Compilation.js:1203:27)
    at hooks.make.callAsync.err (/Users/johnnynolan/Repos/css-modules/node_modules/webpack/lib/Compiler.js:547:17)
    at _err0 (eval at create (/Users/johnnynolan/Repos/css-modules/node_modules/tapable/lib/HookCodeFactory.js:24:12), <anonymous>:11:1)
    at _addModuleChain (/Users/johnnynolan/Repos/css-modules/node_modules/webpack/lib/Compilation.js:1054:12)
    at processModuleDependencies.err (/Users/johnnynolan/Repos/css-modules/node_modules/webpack/lib/Compilation.js:980:9)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)
    npm ERR! code ELIFECYCLE
    npm ERR! errno 1
    npm ERR! css-modules@1.0.0 start: `webpack && open index.html`
    npm ERR! Exit status 1
    npm ERR! 
    npm ERR! Failed at the css-modules@1.0.0 start script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /Users/johnnynolan/.npm/_logs/2018-07-17T14_04_42_021Z-debug.log
EN

回答 4

Stack Overflow用户

发布于 2018-08-28 05:24:28

代码语言:javascript
复制
npm install extract-text-webpack-plugin@next

这对我起了作用!

票数 198
EN

Stack Overflow用户

发布于 2018-07-17 14:23:44

这里的大多数注释( https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/701 )都指向extract-text-plugin,将其改为mini-css-extract-plugin

来自extract-text-webpack-plugin https://github.com/webpack-contrib/extract-text-webpack-plugin的Github回购公司

自webpack v4以来,⚠️不应用于css。使用迷你css-提取-插件代替。

转到mini-css-extract-plugin讨论如何交换/升级it https://github.com/webpack-contrib/mini-css-extract-plugin

票数 84
EN

Stack Overflow用户

发布于 2019-01-15 06:38:27

是的,我和webpack 4.10.2也有同样的问题。在我将extract-css-chunks-webpack-plugin交换到mini-css-extract-plugin之后,问题就解决了。

下面是webpack配置的更改:

代码语言:javascript
复制
-const ExtractCssChunks = require('extract-css-chunks-webpack-plugin')
+const MiniCssExtractPlugin = require("mini-css-extract-plugin");

module.exports = {
  name: 'client',
  target: 'web',
  module: {
    rules: [
      {
        test: /\.css$/,
-       use: ExtractCssChunks.extract({
-         use: 'css-loader'
-       })
+       use: [
+         {
+           loader: MiniCssExtractPlugin.loader,
+         },
+         "css-loader"
+       ]
      }
    ]
  },
// 
// other config........
//
   plugins: [
-    new ExtractCssChunks(),
+    new MiniCssExtractPlugin({
+        filename: `components/[name].css`
+    }),
     //
     // other config........
     //
   ]

希望能帮上忙。

票数 26
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51383618

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档