Can't apply plugins to worker
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 28/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, webpack
- Área
- build-system, tooling
Línea de trabajo
Comienza en src/index.js alrededor de la llamada a createChildCompiler en la línea 59 y revisa el comportamiento de webpack's Compiler.js para los compiladores secundarios en las líneas enlazadas. Rastrea cómo se crean los compiladores secundarios de worker y determina cómo podría proporcionarse una lista de plugins sin afectar a otros compiladores secundarios. Se considera terminado cuando las compilaciones de worker pueden recibir plugins como CompressionPlugin, con cobertura para la configuración compatible.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- JavaScript
- Estrellas
- 2.3k
- Forks
- 85
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de developit/workerize-loader
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
developit/workerize-loader#131 · 6 comentarios · 1 reacción ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 38/100
developit/workerize-loader#130 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 52/100
developit/workerize-loader#129 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
developit/workerize-loader#128 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
developit/workerize-loader#126 · 4 comentarios ·
Todos los issues de developit/workerize-loader
Issues similares
-
awaiting triage bug Causes friction Hop Gui P1 P2 Transforms
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
-
Improve Title Support Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
georgestephanis/p2026#40 ·
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Margaret-Petersen/food-delivery-app-clone-react-native#1981 ·