-
-
Notifications
You must be signed in to change notification settings - Fork 273
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
A modern alternative to the --node-resolve
flag
#2565
Comments
I like this idea in general, mainly because it should improve the debugging experience even further. But the potential caveat is: how do we know in advance what to include in the importmap?
I think dynamic importmaps are not implemented / under discussion now, so it's not really possible to one-by-one inject newly identified bare modules over Web Sockets or smth, but even if it was possible, that would be even more perf cost as compared to current behavior, so I'd rather not go there. Happy to discuss the details. |
There are some interesting community plugins which might help to explore this idea https://github.com/WICG/import-maps#community-polyfills-and-tooling |
JSPM CLI ( Can we use This is the low-level core library for working with import map generation that's used under the hood in the JSPM CLI. |
I'm tinkering with this over at patternfly/patternfly-elements#2655. I think this will need some chin-scratching in order to work with typescript via esbuildPlugin. My current error is
I believe this requires more hooks into JSPM generator, since I have not yet seen a way to tell generator to parse typescript files. Either I'm holding it wrong (likely), or JSPM generator needs a patch or two in order to support the workflow Additionally, I'm unaware of reliable tools to resolve local monorepo (workspaces) directories, so i'll have to hack one together on my own with |
+1 on this feature, we ran into some weird edge cases using |
With the
--node-resolve
option, bare module imports e.g.:will be rewritten on-the-fly to:
What about generating import maps on-the-fly instead of rewriting bare module imports and keep all bare module imports untouched "as is"? I.e. injecting on-the-fly the following to the
index.html
code:Modern browsers now support import maps natively.
This might even have a positive impact on performance and caching (no need to rewrite on-the-fly a bunch of files).
Moreover, for small apps it can be fine to just ship unminified / unbundled sources. So this approach could be applied not only for serving, but also for "building" projects.
The text was updated successfully, but these errors were encountered: