Can't apply plugins to worker
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 28/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- javascript, webpack
- 領域
- build-system, tooling
調査の方向性
src/index.js の 59 行目にある createChildCompiler 呼び出しの周辺から始め、リンク先の行にある webpack's Compiler.js の子コンパイラーの動作を確認します。worker の子コンパイラーがどのように作成されるかを追跡し、他の子コンパイラーに影響を与えずにプラグインリストを渡す方法を判断します。対応する設定をカバーするテストがあり、worker のビルドが CompressionPlugin などのプラグインを受け取れるようになれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Currently there is no way to pass plugins to workerize-loader.
Webpack's documentation is wrong when it states that child compilers inherit all hooks and plugins from the parent compiler. They infact do not inherit plugins at all; they copy over a number of hooks from the parent compiler -- where some plugins may have added them -- to the child compiler.
Several hooks are blacklisted. Banned from this copy process are: make, compile, emit, afterEmit, invalid, done, and thisCompilation. There are ofcourse good reasons not to copy those hooks - as doing so would mess with the control flow for the child compilation and parent compilation. However, it does mean the child compiler has to be fed its own instances of plugins such as the CompressionPlugin which attach to those hooks.
This is what the third plugins argument to the createChildCompiler method is for, but having a look at how the child compiler that creates the body of the worker is called:
it doesn't link up that third parameter. So right now there is no well-defined way to e.g. apply CompressionPlugin and get Gzip or Brotli compressed workers.
It may still be possible to achieve this by tapping the childCompiler hook on the parent compilation, as it does get passed the created child compiler.
This requires people write their own custom "plugin to apply plugins" - which is well beyond the comfort zone of most Webpack users. (Most webpack users don't write their own plugins. That's something you typically only do if you really; really know what you're doing. )
It's also not exactly trivial to get right, as you'd still also need to filter by the child compiler's name to ensure they're only adding plugins to the correct child compilers created by the workerize-loader and not to e.g. those created by the MiniCssExtractPlugin. Making this worse is the fact that those child compiler names are internal implementation details and not part of any public API, i.e. are subject to change over time.
I.e. this is a short-term workaround at best.
- 主要言語
- JavaScript
- スター
- 2.3k
- フォーク
- 85
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
developit/workerize-loader のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
developit/workerize-loader#131 · コメント 6 件 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 38/100
developit/workerize-loader#130 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 52/100
developit/workerize-loader#129 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
developit/workerize-loader#128 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
developit/workerize-loader#126 · コメント 4 件 ·
developit/workerize-loader の issue をすべて見る
似ている issue
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
georgestephanis/p2026#40 ·
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Margaret-Petersen/food-delivery-app-clone-react-native#1981 ·