developit / developit/workerize-loader

Support for export specifiers?

Đang mở
#15 4 bình luận 3 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
JavaScript
Star
2.3k
Fork
85
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.