Using Es6 Modules Without A Transpiler/bundler Step
I'm interested in using a bunch of JS libraries without depending on npm-based tooling and additional bundling steps. With ES6 modules support in the browser, i can use modules lik
Solution 1:
For ES module features without the use of a bundler in "most" browsers try es-module-shims
:
This adds a -shim
variant of the current import map specification. Which can be polyfilled onto browsers with baseline ES module support.
Solution 2:
I found a pending extension that promises to fill this gap: https://github.com/WICG/import-maps
import maps allow to specify a mapping between short module specifiers and a URL:
<scripttype="importmap">
{
"imports": {
"vue": "https://unpkg.com/vue@2.6.10/dist/vue.esm.browser.js"
}
}
</script>
Only downside is, as of now, they're only support in most recent Chrome 74, and hidden behind an experimental flag: chrome://flags/#enable-built-in-module-infra
Post a Comment for "Using Es6 Modules Without A Transpiler/bundler Step"