-
Notifications
You must be signed in to change notification settings - Fork 843
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
Flaws in ESM Build result in failure to build with Vite, Snowpack, etc. #3521
Comments
Thanks for reporting and cross-referencing! For completeness & transparency, we have #3437 tracking a known class of issues with EUI+CRA in development mode. |
Looking through the vite issue linked above, vitejs/vite#280 (comment) has the specific details: EUI itself is ESM compatible (or is theoretically, as we've never proven that and the dynamic icon import may or may not work in a pure browser ESM context), but has cjs-only dependencies - some of which are mentioned in that comment. |
Snowpack seems to somewhat work, with this workaround:
However none of the icons want to work, I'm getting this at runtime:
|
@lemcii do you have a repo available with that setup I could test with? |
As of the latest Snowpack, namedExports should no longer be required thanks to an internal rollup upgrade. |
Thanks, upgrade the example and removed the Did have this error:
Used a workaround from this issue, imagine this may be "fixed" by Snowpack later. |
+1, we should be able to handle global without the need for a node polyfill plugin |
👋 Hey there. This issue hasn't had any activity for 180 days. We'll automatically close it if that trend continues for another week. If you feel this issue is still valid and needs attention please let us know with a comment. |
Hello. Why do this issue be closed? It seems the problem has not been fixed in EUI 42.0.0. |
+1 |
Any workarounds for this? |
I workaround it by adding <script>
globalThis.global = globalThis;
</script> to somewhere before the main script. |
Issue: When including
@elastic/eui
in a project and usingvitejs/vite
orpikapkg/snowpack
to build, a build fails.Investigation so far: The best way to get a summary of investigation so far into this issue (that may or may not continue) is probably to look at this issue in vitejs/vite.
I'm filing this issue mostly for awareness, and of course don't hold any expectation that anyone investigates this, fixes it, etc. I have moved on to using CRA because the benefits of
@elastic/eui
outweighed the benefits ofvite
orsnowpack
for my use case.Cheers
The text was updated successfully, but these errors were encountered: