GoogleChromeLabs / worker-plugin

👩‍🏭 Adds native Web Worker bundling support to Webpack.
https://npm.im/worker-plugin
Apache License 2.0
1.91k stars 79 forks source link

Strict ESM Mode #61

Closed developit closed 4 years ago

developit commented 4 years ago

This fixes an issue where constructing Workers in Webpack's strict mode (javascript/esm) would throw an exception during bundling due to the generated require() statement.

Fixing this required reaching into Webpack internals, and I couldn't find any better way to do it. On the plus side, the output is much nicer and supports module concatenation (new Worker(m.p+"0.worker.js")).

Fixes #38 🎉