generator = new Generator({ ... })
html = generator.htmlInject(htmlText, {
...,
esModuleShims: // <- This option isn't working as expected
})
I was attempting to try 'swapping' the order of script tag inclusion. Currently the es-module-shims script is added before the import map - and this doesn't work on Firefox. I haven't actually found that switching the script tag order around improves things for Firefox, however I have found that the htmlInject has some limitations that seems like bugs.
So long as I'm using htmlInject there are limitations in terms of manually including an es-module-shims script, which may be useful to pin a specific version of the script, or other general reasons. Here are the cases:
esModuleShims: true: This places the es-module-shims script above the script tag (and removed manually added one)
esModuleShims: false: This removes any es-module-shims script tag that I have included in the HTML manually
esModuleShims: undefined: This removed manually added es-module-script tag and reinserts above import map (i.e. same behaviour as true)
esModuleShims: null: This acts the same was as when set to false
<don't include this option>: This acts the same was as when set to false
Using the generator like so:
I was attempting to try 'swapping' the order of script tag inclusion. Currently the es-module-shims script is added before the import map - and this doesn't work on Firefox. I haven't actually found that switching the script tag order around improves things for Firefox, however I have found that the
htmlInject
has some limitations that seems like bugs.esModuleShims: true
: This places the es-module-shims script above the script tag (and removed manually added one)esModuleShims: false
: This removes any es-module-shims script tag that I have included in the HTML manuallyesModuleShims: undefined
: This removed manually added es-module-script tag and reinserts above import map (i.e. same behaviour astrue
)esModuleShims: null
: This acts the same was as when set tofalse
<don't include this option>
: This acts the same was as when set tofalse
I found this out as I was trying to debug why the import maps are not working in firefox (https://github.com/jspm/generator/issues/160)
What I would expect is that:
esModuleShims: true
: This would work as it currently does. It makes sense to dedupe the shims tagesModuleShims: Any falsey value
: This should not remove any script tags that I have manually included in my HTML