Package threads.js in a library
lib
is built with parcel for NodeJS (CJS module) and for browsers CDN deliverymain-parcel
works as expected (with and without thethreads/register
!?) - (resolved frompackage.json:module
)main-webpack
works as expected if we removethreads/register
fromlib
and import theThreadsPlugin
- (resolved frompackage.json:module
)main-node
works as expected with the parcel CJS build (resolved frompackage.json:main
)main-vue
behaves likemain-webpack
main-react
requiresnpm run eject
to configure webpack plugins, then behaves likemain-webpack
- CDN delivery is impossible with the parcel browser build as code splitting creates a dedicated worker file, I wasn't able to disable code splitting automatically enabled by parcel
Tree shaking does not work with threads.js and parcel (see npm run build:browser:treeshaking
):
../node_modules/threads/dist-esm/worker/implementation.browser.js does not export 'default'