-
-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentation about parcel build is deprecated ? + tree-shaking not working #232
Comments
Hey @PacoDu! Let’s start with the easy bit: There is already some (a bit implicit) discussion in #211. Spawning workers from blobs bundled with the library might be a promising approach in the future. |
Have you only tried building it or have you also tried running the resulting bundles? The issue with Parcel has always been that it detects Parcel would still produce an output bundle, but it would have failed to create a second bundle for the worker on Didn’t have time to actually run your test setup yet, though. |
Hey !
Yes, every
It doesn't seem to be the case with the current version of
Thanks for the related issue, this is indeed possible with webpack but, to my knowledge, not with parcel 😟. Maybe it will be possible in parcel v2, not sure tho. |
@PacoDu Can we close this issue? Tbh, I lost the overview here… 😉 |
But it's not resolved, if you want I can create 2 issues: one about the tree shaking not working on parcel and an other one about the |
That sounds like a good idea 👍 |
Hi, I did some tests to package a library that depends on threads.js and is built with parcel-bundler.
For compatibility purposes with NodeJS and browsers the library is written in ES6 then compiled in CJS for NodeJS and bundled for CDN delivery.
What I discovered is that the recommended parcel import to register threads.js (described here) doesn't have any effect, and the library is working as expected without the
import 'threads/register'
. It also prevents users to properly build their application if they want to use webpack.The CDN delivery method is not working as we can't import the worker as parcel automatically split the worker code in a different file.
I've created a test repository https://github.com/PacoDu/threads-package that defines a simple library using threads.js and implement multiple client softwares using this library.
Also the
--experimental-scope-hoisting
(tree-shaking) option of parcel is not working with threads.js it throws:Maybe I'm doing this the wrong way. Do you have any recommendation for packaging threads.js in a library ? (maybe it should be a
peerDependencies
?)The text was updated successfully, but these errors were encountered: