-
Notifications
You must be signed in to change notification settings - Fork 19
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
[esbuild-plugin-meta-url] has no effect #47
Comments
The following resolve is returning an empty string within the plugin:
|
I found the issue 🎉 The following works:
while this is not working:
Both should work afaik. Should we just prepend the |
Hello! Thanks for opening the issue and the PR. I am afraid this is the intended behavior of esbuild. Under the hoods, we use the esbuild resolution algorithm to resolve paths:
We cannot automatically add BUT we could add a check for relative urls if the first try fails and it is not a relative url already. Would you like to update the PR with this behavior? |
I kind of agree that resolving modules could be handy for users. I would put that under a feature flag though as it does not conform to the default behavior. In plain ES6 That means by definition resolving a file though URL + import.meta.url is relative. When transforming such a URL construct we should keep the relativity. I tried the current implementation against the generated code by wasm_bindgen which expects it to be foremost relative. |
Hello @maxammann. We have released a new version of the plugin (0.15.17). As you suggested, we tried to closely match the standard |
I recently started a project which tries to implement a map renderer in Rust. I'm currently evaluating which bundler is the best for the task as I require two features:
import.meta.url
in CJS and ESM modules, especially for .wasm files.I tried the plugin
@chialab/esbuild-plugin-meta-url
to solve the second goal, but esbuild is not copying assets to the output directory.Config:
build.mjs
Is there more configuration needed?
The text was updated successfully, but these errors were encountered: