-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
ESM browser module distribution depends on unsupported import #694
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
Comments
I'm aware of this but I couldn't find any standard/agreement on how to write an import on a browser module file without forcing the user to use a specific CDN (which I can't)... One (quite complicated) way to deal with this is to use a service worker to redirect the request for FYI, in vue router 3 we handled this the same way it is handled here: vuejs/vue-router#2705 I'm open to suggestions! |
The module URL must be resolved before a request can be initiated (and intercepted). Parsing the message property of a caught exception isn't complicated but madness. Sounds like a job for jQuery. 😂
I saw that after opening this issue, thanks. It is extremely discouraging that the Vue 2 ecosystem did allow coding like it's 2015. ☹
I wish I had any. At this point I fail to see te use case of these build artefacts. The answer is appreciated, anyhow. |
While it's not possible to intercept bare modules because that fails before there is a request, it turns out it's still possible to create a workaround with a service worker:
It's quite mad, but still better than using the global legacy build for modern development without Node. |
Currently, one needs to use Skypack or https://www.chromestatus.com/feature/5315286962012160 (chrome only). I think this will make sense as a cookbook entry once these topics are more mature |
Thanks, both were new to me. Cookbook entries and generally more documentation would be great, |
This comment has been minimized.
This comment has been minimized.
|
It looks like every browser, other than old Safari, supports import maps I suppose it would be possible to use the ESM browser module, and add a documentation note about "this needs an import map polyfill if you're targeting Safari". |
So how does one work around this with skypack? |
So I'm trying to use vue-router in browser with import maps... how do I workaround these errors?
This is failing with devtools errors? |
Until
|
Version
4.0.2
Reproduction link
https://besenwagen.github.io/vue-router-next-broken-esm-browser-dist/
Steps to reproduce
What is expected?
The ES module import is resolved.
What is actually happening?
A TypeError is thrown because 'vue' is not resolvable.
The text was updated successfully, but these errors were encountered: