Avoid use of `eval` in worker_threads.ts?
- 主要语言
- TypeScript
- 星标
- 3.5k
- 派生
- 173
- PR 合并指标
- 30 天内没有已合并 PR
描述
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!
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。