-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESM support #978
base: master
Are you sure you want to change the base?
ESM support #978
Conversation
This PR does not work in vite browsers builds. I will look into a solution to support browsers as well.
|
f802e37
to
12d09d5
Compare
fixes mholt#977
With the latest force push, I added the esm directory, which supports esm + browser & esm + module exports, using esm/package.json. ESM & vite browser builds are now supported. {
"main": "./index.mjs",
"browser": "./index.browser.mjs"
} "browser" takes precedence over "main" & "module" takes precedence over "browser", which is why I'm using "main" & "browser". I have tested this in my astro.js/vite browser & server side builds. |
There's a problem with the latest force pushed commit. The vite server side build seems to use the "browser" import, which causes an error:
Looking into another fix for this... |
…await plugin package is used See vitejs/vite#12253 See mholt#978
If vite fixes the issue vitejs/vite#12253, then this PR should work. In the meantime, I added https://github.com/btakita/PapaParse/tree/vite-plugin-top-level-await, which will work in server side vite builds using the vite-plugin-top-level-await plugin package. |
Would this allow us to use esm modules in angular-cli as well? Or would more work need to be done for that? Trying to avoid the "optimization bailouts" warning. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This modification works for my Nuxt3 project deploying on Cloudflare worker, where I couldn't deploy LLaMAindex since the current version doesn't come with an ESM support. Thx for your contribution!
So? Can we after years get ESM build? |
fixes #977