Chunk.entrypoints: Gunakan Chunks.groupsIterable dan filter dengan instance dari Entrypoint sebagai gantinya


91

Saya melihat kesalahan berikut saat mencoba memulai aplikasi saya ...

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

webpack && buka 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 mungkin melempar sesuatu. Posting seluruh pelacakan tumpukan dan konfigurasi paket
— web Anda

Saya sarankan Anda mengedit pertanyaan Anda menjadi pertanyaan yang lebih mirip seperti "Bagaimana saya bisa menyelesaikan ini?" alih-alih "Apakah ada yang pernah melihat ini sebelumnya?"
— Amy

3
ekstrak-teks-plugin tidak bekerja dengan Webpack v4
— IVO GELOV

Jawaban:


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

Ini berhasil untuk saya!


1
@Next memberi saya "^ 4.0.0-beta.0", persis seperti yang saya butuhkan. Terima kasih.
— Paula Fleck

82

Sebagian besar komentar di sini https://github.com/webpack-contrib/extract-text-webpack-plugin/issues/701 menunjuk untuk extract-text-pluginmengubahnya menjadi mini-css-extract-pluginsebagai gantinya.

Dari repo Github di extract-text-webpack-plugin https://github.com/webpack-contrib/extract-text-webpack-plugin

⚠️ Sejak webpack v4 ekstrak-teks-webpack-plugin tidak boleh digunakan untuk css. Gunakan mini-css-ekstrak-plugin sebagai gantinya.

Buka mini-css-extract-plugintentang cara menukar / meningkatkannya https://github.com/webpack-contrib/mini-css-extract-plugin


21

Ya, saya mendapat masalah yang sama dengan webpack 4.10.2. Masalah teratasi setelah saya menukar extract-css-chunks-webpack-pluginke mini-css-extract-plugin.

Berikut perubahan konfigurasi webpack:

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

Semoga bisa membantu.


Itu memang membantu lebih dari jawaban di atas. Terima kasih.
— Paolo Stefan

7

Saya telah tetap bug dengan menggunakan versi 4.0.0-beta.0dari extract-text-webpack-plugin.


4
Memperbarui ke 4.0.0-beta.0 juga memperbaiki masalah saya
— JillAndMe

VS Code tidak memiliki pelengkapan otomatis untuk 4.x jadi terima kasih telah menyelamatkan saya dari pencarian Google lainnya dengan versi eksplisit.
— steven87vt

jalan apa itu?
— Grald
Dengan menggunakan situs kami, Anda mengakui telah membaca dan memahami Kebijakan Cookie dan Kebijakan Privasi kami.
Licensed under cc by-sa 3.0 with attribution required.