-
Notifications
You must be signed in to change notification settings - Fork 74
Allow collapsing to a bundle using the hash symbol #185
Description
This is essentially a duplicate of #145 and #56 . With the latter one (issue 56) it was mentioned that, essentially, supporting bundled files is not part of import-maps, but will part of the package proposal. But it seems it will take quite a while for the package proposal to come to fruition, and in the meantime, we cannot effectively utilize CDN bundles without creating a massive JSON mapping. See my issue above for why I think supporting CDN bundles would be quite useful.
So I thought I came up with a clever hack to get some earlier support for this much needed requirement, but it doesn't work, and I want to make sure there's a good reason why it doesn't.
I have a reference to two files in my source JS:
import "@ui5/webcomponents/dist/Input.js";
import "@ui5/webcomponents/dist/TextArea.js";In my import mapping, I created this:
<script type="importmap">
{
"imports": {
"@ui5/": "https://storage.googleapis.com/pika-web-packages-02/ui5-buffet/0.0.0/dist-es2019/ui5-buffet.min.js#/"
}
}Here's my (apparently naive) thinking: based on the mapping, the import for Input.js should resolve to:
And the import for TextArea should resolve to:
But generally speaking, the part of the url after the hash symbol (#) isn't sent to the server, meaning both references would really be pointing to the same (bundled) file.
Instead, Chrome 77 seems to be dropping the last part of the url (ui5-buffet.min.js):
Why? It seems like it is going out of its way to prevent having multiple files resolve to the same file, with a single line in the import map configuration.