developit / developit/workerize-loader

Support for export specifiers?

Abierto
#15 4 comentarios 3 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
JavaScript
Estrellas
2.3k
Forks
85
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

It appears like `workerize-loader` only supports moving [export declarations](https://github.com/developit/workerize-loader/blob/master/src/index.js#L52) in the target module into a worker. I'm attempting to use it with [Bucklescript](https://bucklescript.github.io/), which compiles modules down to an export specifier list, i.e. `export { foo, bar, }` instead of export declarations.

I took a pass at implementing this and couldn't get around Webpack [declaring its own parser plugin and bailing on `export specifier`](https://github.com/webpack/webpack/blob/master/lib/dependencies/HarmonyExportDependencyParserPlugin.js#L39), I think for tree-shaking purposes. I don't have much experience with Webpack plugins though and it seems like there should be a way to get this to work. Are there any alternate approaches you can suggest, or maybe workarounds?

One other thought I had for my purposes would be to instead compile to commonjs and tweak [workerize](https://github.com/developit/workerize) so that it would accept the pre-compiled source instead of doing the current find-and-replace compilation step.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Línea de trabajo

Start with export handling in src/index.js and reproduce the BuckleScript-generated export specifier list. Read the linked Webpack HarmonyExportDependencyParserPlugin behavior to understand why export specifiers are rejected, then compare the proposed CommonJS and workerize alternatives. Done means a supported approach or a documented workaround is established and tested.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript
Área
devtools, web-dev
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.