Browser ES module #8820
Unanswered
stefanvanherwijnen
asked this question in
Ideas / Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have been struggling with Rollup, Vite and JavaScript for a bit. It seems pretty standard to generate a CJS, ESM and UMD build of a package (as Quasar does), but with almost all browsers finally supporting ES modules it seemed like a good idea to ditch CJS and UMD in order to simplify things.
However, of course it's not that simple and importing the Quasar ESM build in the browser results in
which is obviously caused because there is no 'vue' package. I'm not sure how modules are resolved in the browser but I noticed that Vue provides a separate browser ESM build.
So my question is: would it be possible to build a browser-compatible module of Quasar?
And please enlighten me if I'm overlooking anything in the maze of JavaScript modules.
Edit:
The problem can be solved by using an importmap. Unfortunately, these are not supported by most browsers, but this is where es-module-shims comes in. The following html works for me in Firefox:
So fortunately Quasar ESM works fine in the browser, and now the question is: would this be a viable alternative to UMD or am I overlooking something?
Beta Was this translation helpful? Give feedback.
All reactions