-
Notifications
You must be signed in to change notification settings - Fork 3.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
Webpack workaround #22605
Webpack workaround #22605
Conversation
@seanmorris BTW are you targetting node? If not and you are only targeting that web you might also want to simple remove this code using |
How does webpack handle |
That works great. Its just |
My project has separate builds for all targets, but not everyone wants to do that. This is for the countless downstream projects that want to publish universal builds. There are valid reasons for that, too. I need to be VERY careful about the size of my project, php-wasm. I'm publishing separate builds for all targets in cjs & mjs. If I go over a certain limit (100mb total package size), I can't publish my project via CDNs like jsdelivr or unpkg. So far I've solved the problem by splitting the extensions off into their own packages and loading them dynamically as I'd really like to maximize interoperability. If there's a roadblock we can remove with a small notation change, then I say we do it, at least until webpack figures their mess out. I see a LOT of potential in this project for interoperability. If someone wants to re-use code in a webpack project, but can't because of how its been published, that's going to cut the Emscripten userbase significantly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with comment addressed
The string of code
new URL('./', import.meta.url)
causes webpack to try and resolve the URL, which causes problems for downstream users who are using that bundler:webpack/webpack#16878
electric-sql/pglite#328
This PR replaces
new URL('./', import.meta.url)
withnew URL('./', Object(import.meta).url)
, which is a workaround for this behavior.