-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Support Web Workers coming from node_modules #670
Comments
Here's my full code at the moment if you'd like to have a look: https://github.com/wojtekmaj/react-pdf/tree/parcel/sample/parcel |
Ah this is an interesting issue. We treat the argument to Worker as a URL, which it can be. That means this is being treated as a relative path rather than a Node module path. We could maybe require the path to start with |
Actually that would be great. Not having
I'd greatly appreciate this improvement. I'm really looking forward to support Parcel :) |
The correct term would be web worker. Service workers handle caching and push notifications. |
Guys, is there any news regarding that matter? I'd really like to officially support Parcel in React-PDF, but I'm super unsure about web worker necessary for my project to run correctly. It seems like my workaround is doing the trick, but to me it looks just messy. Is there an official, recommended way to handle this? |
@devongovett Inspired by the new resolver:
|
For Parcel 2, we are considering supporting an new Worker('npm:pdfjs-worker'); Without the See #3492 (comment) for more details. |
worker-loader is a webpack specific tool and won’t work with parcel. You can construct a worker like this: new Worker(“./worker.js”) |
@MikeYermolayev I fear there's nothing you can do here. (And I think publishing code with worker-loader calls is bad for exactly this reason). |
@mischnic yep. Had to reject using that library |
Choose one: is this a 🐛 bug report or 🙋 feature request?
Both, I guess?
🤔 Expected Behavior
😯 Current Behavior
what it is trying to do is look for the path in
./
but not innode_modules
.🔦 Context
💻 Code Sample
I'm currently working on support for Parcel in React-PDF. That requires me to handle loading a service worker which is not mine.
In Webpack, the following code does the job:
I was trying to reproduce the same using Parcel, and here's what I got so far:
This results in an error described below. Changing the line to
stops the error, but:
🌍 Your Environment
The text was updated successfully, but these errors were encountered: