-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
Bundling with rollup #123
Comments
Hey @wheelere! The issue is probably based on the fact that no ES modules are published, but only their transpiled CommonJS equivalents. You can first try to use I will also try to publish a new version that comes with both, CommonJS and ES modules. That should solve the issue as well. |
Done. You can try to Let me know how it went 😉 |
Thanks! It works! |
I'm still getting a build issue:
|
Can you add the error output for |
PS: Did you install I quickly tried it myself, using |
The version of Beyond that, my rollup.config.js file isn't very notable. Could my output format cause the issue? I'm configuring for UMD. The require is undefined error isn't very verbose in the browser, and the line number isn't very helpful, but it's pointing to the statement:
There are a few other places in the bundled file where require is used, as well. |
I'm still not sure what's causing the issue with this -> undefined, but I believe the issue with require has to do with the use of |
I think I might have a fix. Will get back to this tonight or tomorrow morning. |
Try |
That fixed the this -> undefined warnings, but the shim you're using for
causes
Rollup is still complaining, but only about the use of Also, I'm still seeing an instance of require in the code:
|
What shim? 😅
This should only be a warning. We can have a look if there is any other way around it, but that hack is required to make |
Oops, that's in one of my other packages! |
Give it a try and tell me if it works 😉 Should work, though. In the feature branch with the rollup fixes I now even added an integration test that bundles a tiny sample app that uses |
I'm still having issues 🙁
even after that (if I don't bundle the worker) I hit the same issues I was hitting with I'm new to all of this package management, so I'm totally at a loss. |
If you are new to all this, let me give you a tip: Don't use rollup! 😅🙈 If you are looking for something that just works, rollup is probably not the place to look for. Have used it myself a few times and it always costed me a lot of time to get it working. It's also full of reports of badly handled edge cases that will easily break any setup and are hard to debug... |
Use webpack or parcel or browserify or whatever. Chances are that every one of them will get you there in shorter time and with less hair pulling, I think. |
PS: If you still wanna use rollup: There was an issue with the This has now been fixed: #127. Shall I publish one more updated hopefully-rollup-friendly pre-release version? |
That would be great! My mentor insists I use rollup for my project. I took a break from trying to figure out how to use rollup, typescript, and web workers simultaneously and worked on other areas of the project, but I'm getting back to it now, and still struggling. Sorry for the delayed follow up! |
Just published |
Still having issues many :( |
Just out of curiosity: Is it only threads.js you are having trouble with when trying to bundle with rollup or is it other packages, too? |
Threads.js is the only one throwing errors at me. Most packages are working fine, but the other plugins I've tried to use to bundle a worker with rollup fail silently (that is, they compile, but the worker doesn't respond). |
Closed by #124 🚀 |
I'm trying to use rollup to bundle my project, but I get
Error: 'spawn' is not exported by ../../node_modules/threads/dist/index.js
Is it possible to use this package with Rollup?
The text was updated successfully, but these errors were encountered: