You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Flaws in ESM Build result in failure to build with Vite, Snowpack, etc. #3521
Issue: When including @elastic/eui in a project and using vitejs/vite or pikapkg/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 of vite or snowpack for my use case.
Cheers
Reacted by Chandler Prall, Mario Gutierrez and Benjamin Kniffler
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.
However none of the icons want to work, I'm getting this at runtime:
Loading module from “http://localhost:8080/web_modules/@elastic/assets/'%20+%20typeToPathMap[iconType]%20+%20'.js” was blocked because of a disallowed MIME type (“”).
localhost:8080
Loading failed for the module with source “http://localhost:8080/web_modules/@elastic/assets/'%20+%20typeToPathMap[iconType]%20+%20'.js”. localhost:8080:698:1
TypeError: error loading dynamically imported module
👋 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.
Activity
chandlerprall commentedon May 28, 2020
Thanks for reporting and cross-referencing! For completeness & transparency, we have #3437 tracking a known class of issues with EUI+CRA in development mode.
chandlerprall commentedon May 28, 2020
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.
lemcii commentedon May 30, 2020
Snowpack seems to somewhat work, with this workaround:
However none of the icons want to work, I'm getting this at runtime:
chandlerprall commentedon Jun 1, 2020
@lemcii do you have a repo available with that setup I could test with?
lemcii commentedon Jun 2, 2020
@chandlerprall sure, here https://github.com/lemcii/snowpack-eui-test
FredKSchott commentedon Jun 22, 2020
As of the latest Snowpack, namedExports should no longer be required thanks to an internal rollup upgrade.
lemcii commentedon Jun 23, 2020
Thanks, upgrade the example and removed the
namedExportsworkaround above.Did have this error:
Used a workaround from this issue, imagine this may be "fixed" by Snowpack later.
FredKSchott commentedon Jun 23, 2020
+1, we should be able to handle global without the need for a node polyfill plugin
github-actions commentedon Mar 11, 2021
👋 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.
balthild commentedon Dec 8, 2021
Hello. Why do this issue be closed? It seems the problem has not been fixed in EUI 42.0.0.
aircjm commentedon Dec 17, 2021
+1
theamanbhargava commentedon Jan 11, 2022
Any workarounds for this?
balthild commentedon Jan 11, 2022
I workaround it by adding
to somewhere before the main script.