WICG / import-maps

How to control the behavior of JavaScript imports
https://html.spec.whatwg.org/multipage/webappapis.html#import-maps
Other
2.68k stars 69 forks source link

"importmap" way will fail #177

Closed Megabyteceer closed 4 years ago

Megabyteceer commented 4 years ago

Any even most reachests config once will face with unpredicted case and you will need importmaps2.0. Only handling ambigous imports via javascript gives you full flexibilyty. Its better to add document event "ambigousmodule" where you can subscribe many handlers, and even each module can have its own handler. In event object we can pass fixed import url and check it in all handlers by chain. Its easier for implementation and will certainly cover any cases will arace in future.

domenic commented 4 years ago

This isn't really informative enough to be actionable, and seems to be pushing a proposal (programmatic hooks) which is already rejected in the explainer.

Megabyteceer commented 4 years ago

Lets create explainer agains import maps?

Importmaps have many rules, it willl bring mess in browsers support. And each browser will have differences in impplementation. Pure js way have only one rule, and its have less ways to implement it different for different browsers. Its will be another one CSS.

Whole current importmap implementation can be jus subset of js way.

You can always debug js handling via event breakpoints, and pass all handlers step by step. Config way, in case of typo just will not work, and it will be hell to find whats wrong if your config is big and its many configs created in runtime.

About performance. In worst case js invoking will take 0.001% against file fetch it self. Also internal modules can use relative paths inside namespaces, so, not all module imports will need mapping invoking.

Is not explainer agains js hooks too weak?