How to handle Node.js Worker threads in Webpack?

1.5k views Asked by At

Using Web Workers for the browser is handled by the official worker-loader Webpack module.

Unfortunately worker-loader does not handle Node.js Worker threads.

I'm using Webpack to bundle an AWS Lambda function running on Node.js. And I want to use Node.js Worker threads that requires having dedicated files for each worker implementation.

So what is the best way to handle Node.js Worker threads within a Webpack bundle?

Note: This is a question about handling Node.js workers server side (not in browser).

Edit: Webpack handles Worker threads but need to switch from CommonJS to ESM https://github.com/webpack/webpack/issues/15961

0

There are 0 answers