Chunk.entrypoints: utilice Chunks.groupsIterable y filtre por instancia de Entrypoint en su lugar


91

Veo los siguientes errores al intentar iniciar mi aplicación ...

> css-modules@1.0.0 start /Users/johnnynolan/Repos/css-modules

webpack && open index.html

(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

css-modules podría estar arrojando algo. Publique todo el seguimiento de la pila y la configuración de su paquete web
— PlayMa256

Le sugiero que modifique su pregunta a algo más parecido a "¿Cómo puedo resolver esto?" en lugar de "¿Alguien ha visto esto antes?"
— Amy

3
extract-text-plugin no funciona con Webpack v4
— IVO GELOV

Respuestas:


190
npm install extract-text-webpack-plugin@next

¡Esto funcionó para mí!


1
El @next me trajo el "^ 4.0.0-beta.0", precisamente lo que necesitaba. Gracias.
— Paula Fleck

82

La mayoría de los comentarios aquí https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/701 apuntan a extract-text-plugincambiarlo mini-css-extract-plugin.

Desde el repositorio de Github de extract-text-webpack-plugin https://github.com/webpack-contrib/extract-text-webpack-plugin

⚠️ Desde webpack v4, el plugin extract-text-webpack-plugin no debe usarse para css. En su lugar, utilice mini-css-extract-plugin.

Dirígete a mini-css-extract-plugincómo cambiarlo / actualizarlo https://github.com/webpack-contrib/mini-css-extract-plugin


21

Sí, tengo el mismo problema con el paquete web 4.10.2. El problema se soluciona después de cambiar extract-css-chunks-webpack-plugina mini-css-extract-plugin.

Aquí están los cambios de configuración del paquete web:

-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........
     //
   ]

Espero que pueda ayudar.


De hecho, ayudó más que las respuestas anteriores. Gracias.
— Paolo Stefan

7

Corregí el error usando la versión 4.0.0-beta.0de extract-text-webpack-plugin.


4
La actualización a 4.0.0-beta.0 también solucionó mi problema
— JillAndMe

VS Code no tenía un autocompletado para 4.x, así que gracias por guardarme otra búsqueda en Google con una versión explícita.
— steven87vt

que camino es ese
— Grald
Al usar nuestro sitio, usted reconoce que ha leído y comprende nuestra Política de Cookies y Política de Privacidad.
Licensed under cc by-sa 3.0 with attribution required.