-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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 for import.meta.resolve(...)
#2866
Comments
import.meta.url(...)
import.meta.resolve(...)
`make js-api-tests` fails to include the worker file in the build. This is an adaptation of evanw#2470 , for evanw#2866
One wrinkle is that
It is clearly a feature "from 2022", but it isn't formally part of That said, it is already fully supported by Chrome, Firefox, Safari, I'd advocate for:
|
It seems I was mistaken about this at the time — Safari required the feature to be enabled manually from the developer menu. However, Safari 16.4 is now out, and supports this directly by default. I've thoroughly tested that all modern browsers now support |
@evanw: This is becoming an urgent point of incompatibility for several of my apps and libraries, as it is currently impossible to publish ESM libraries (using widely compatible syntax & APIs) that use web workers and/or WASM while also remaining sufficiently compatible with bundlers. Could I ask for an indication whether you would support adding this feature (or #795) — in particular, whether you would accept a pull request to implement it?1 I would be happy to invest a lot of effort to make this happen if you would be amenable. For more context:
Footnotes
|
I would prefer to avoid hardcoding any paths except those that are published as CDN entry points, but `esbuild` still doesn't support `new URL(…, import.meta.url)` (evanw/esbuild#312) or `import.meta.resolve(…)` (evanw/esbuild#2866).
…irefox. Users of the CDN can't prevent the worker failure messages, so they are just noise (and a potential slowdown). This hardcodes the entry file path where the instantiator (which reliably ends up in a chunk for us) expects it: https://github.com/cubing/cubing.js/blob/4afc6d727549aadc1e82abf52d531565953e7a9a/src/cubing/search/worker-workarounds/index.ts#L11 I would prefer to avoid hardcoding any paths except those that are published as CDN entry points, but `esbuild` still doesn't support `new URL(…, import.meta.url)` (evanw/esbuild#312) or `import.meta.resolve(…)` (evanw/esbuild#2866).
`make js-api-tests` fails to include the worker file in the build. This is an adaptation of evanw#2470 , for evanw#2866
This is a bit of an old issue, but have you considered using import-meta-resolve? |
I don't really follow. However, (I'd still be happy to finish up my branch for it if I can get an indication from @evanw that a pull request would be welcome.) |
From #2508 (comment), as an alternative to:
new URL("...", import.meta.url)
references in the import graph. #2470The text was updated successfully, but these errors were encountered: