Avoid use of `eval` in worker_threads.ts?
- Vorherrschende Sprache
- TypeScript
- Sterne
- 3.5k
- Forks
- 173
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
https://github.com/andywer/threads.js/blob/42b1042f9a0057fd25c94807ba4ac988e6475916/src/worker_threads.ts#L20
Thanks for all your work on `threads.js`! I am working with `rollup` and running into an issue due to the use of `eval("require")("worker_threads")` when creating an ESM output. Rollup cannot convert the `eval("require")` to a top-level import statement `import require$$0 from 'worker_threads'` since it doesn't not recognize it statically as a commonjs `require("worker_threads")`.
This means that in the final ESM bundle ends up with a `eval("require")` which throws at runtime since require is not allowed when using ESM in node. I see the comment "Webpack hack" and am curious if the use of eval is a part of that hack? Or would there be an option to avoid the use of `eval` and change this to `require("worker_threads")`? Cheers!
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.