3 ms·
Huh. I was about to complain that this breaks with web standards, but apparently it's being proposed as a standard feature: https://github.com/WICG/import-maps
by brundolf 4y ago
Huh. I was about to complain that this breaks with web standards, but apparently it's being proposed as a standard feature: https://github.com/WICG/import-maps https://github.com/WICG/import-maps
Interesting!
- singularity2001 4y agoHow can it break a web standard when this server-side mess of different require(), import(), import "npm:", import ".mjs" does not directly translate to browser code anyways? Interesting indeed that you can remap whole URLs: { "imports": { "https://www.unpkg.com/vue/dist/vue.runtime.esm.js https://www.unpkg.com/vue/dist/vue.runtime.esm.js": "/node_modules/vue/dist/vue.runtime.esm.js" } } "… instead grab the one from the local server." This will surely result in much power and confused human debuggers;) Changing import maps will also be a prime target for some class of hacks.
- brundolf 4y ago> How can it break a web standard when this server-side mess of different require(), import(), import "npm:", import ".mjs" does not directly translate to browser code anyways? require() and .mjs are specific to Node (Deno does away with them), import() is actually a web standard. Not sure how npm: fits into things, though if you're importing an NPM dependency directly you're almost certainly pulling in some non-web stuff anyway, so maybe they just decided that was a lost cause But "web standards compatible" is one of Deno's stated goals. A whole lot of the Deno code out there (or at least a much larger portion than Node code) can be imported directly, with no preprocessinng, by browser scripts. That's a super exciting goal to work towards.
- WorldMaker 4y ago`npm:` fits the form of a URL/URI in the most basic syntax sense (`protocol:resourceviathatprotocol`, just as `http:` indicates a protocol). `npm` is not currently an IANA registered protocol [1], but it easily could be. There's nothing it would currently conflict with. Also, URLs with unregistered protocols are relatively common on the web today as URLs anyway. A lot of applications use unregistered protocols like `twitter:` or other `myappname:` for deep linking into mobile apps and PWAs. In most cases the user's operating system's registry of protocols wins over IANA's more generalized registry of protocols. [1] https://www.iana.org/protocols#index_N https://www.iana.org/protocols#index_N