Repository navigation
Closed
Labels
Description
Do NOT ignore this template or your issue will have a very high chance to be closed without comment.
Describe the bug
When attempting to import/utilize @elastic/eui, vite cli reports an error (Error: EISDIR: illegal operation on a directory, read) and app is not functional.
I am guessing this has something to do with bare imports, but am not sure what alternative I have in this situation.
Reproduction
All code in this repo is what is bootstrapped when doing npm init vite-app <project-name> --template react except for this import statement.
System Info
- required
viteversion:0.17.1 - required Operating System: macOS 10.14.6
- required Node version:
11.13.0 - Optional:
- npm/yarn version:
[email protected] - Installed
vueversion (fromyarn.lockorpackage-lock.json): n/a (react) - Installed
@vue/compiler-sfcversion: n/a (react)
- npm/yarn version:
Logs (Optional if provided reproduction)
- Run
viteorvite buildwith the--debugflag. - Provide the error log here.
vite v0.17.1
vite:config env mode: development +0ms
vite:config env: {} +1ms
vite:config config resolved in 36ms +1ms
vite:optimize Hash is consistent. Skipping. Use --force to override. +0ms
Dev server running at:
> Local: http://localhost:3000/
> Network: http://192.168.0.17:3000/
vite:server server ready in 185ms. +0ms
vite:hmr ws client connected +0ms
vite:rewrite /: rewriting +0ms
vite:hmr / imports /@react-refresh +23ms
vite:rewrite no imports rewritten. +2ms
vite:hmr / imports /src/main.jsx +0ms
vite:rewrite (skipped) / +1ms
vite:rewrite /src/main.jsx: rewriting +263ms
vite:rewrite "react" --> "/@modules/@pika/react/source.development.js" +2ms
vite:hmr /src/main.jsx imports /@modules/@pika/react/source.development.js +266ms
vite:rewrite "react-dom" --> "/@modules/@pika/react-dom/source.development.js" +1ms
vite:hmr /src/main.jsx imports /@modules/@pika/react-dom/source.development.js +1ms
vite:rewrite "./index.css" --> "/src/index.css?import" +0ms
vite:hmr /src/main.jsx imports /src/index.css +0ms
vite:resolve (extension) /Users/joshuaacheson/code/vite-eui-bug-repro/src/App -> /Users/joshuaacheson/code/vite-eui-bug-repro/src/App.jsx +0ms
vite:rewrite "./App" --> "/src/App.jsx" +1ms
vite:hmr /src/main.jsx imports /src/App.jsx +1ms
vite:rewrite (skipped) /vite/hmr +5ms
vite:rewrite /@react-refresh: no imports found. +4ms
vite:resolve (node_modules) @pika/react-dom/source.development.js -> node_modules/@pika/react-dom/source.development.js +0ms
vite:resolve (node_modules) @pika/react/source.development.js -> node_modules/@pika/react/source.development.js +1ms
vite:rewrite /@modules/@pika/react/source.development.js: no imports found. +50ms
vite:rewrite /src/index.css: rewriting +53ms
vite:rewrite no imports rewritten. +0ms
vite:rewrite /src/App.jsx: rewriting +37ms
vite:hmr /src/App.jsx imports /@react-refresh +150ms
vite:hmr rewriting /src/App.jsx for HMR. +0ms
vite:rewrite "react" --> "/@modules/@pika/react/source.development.js" +6ms
vite:hmr /src/App.jsx imports /@modules/@pika/react/source.development.js +5ms
vite:resolve (node_module entry) @elastic/eui -> es +156ms
vite:rewrite "@elastic/eui" --> "/@modules/@elastic/eui/es" +1ms
vite:hmr /src/App.jsx imports /@modules/@elastic/eui/es +1ms
vite:rewrite "./logo.svg" --> "/src/logo.svg?import" +0ms
vite:hmr /src/App.jsx imports /src/logo.svg +0ms
vite:rewrite "./App.css" --> "/src/App.css?import" +0ms
vite:hmr /src/App.jsx imports /src/App.css +0ms
vite:rewrite /@modules/@pika/react-dom/source.development.js: rewriting +19ms
vite:rewrite "react" --> "/@modules/@pika/react/source.development.js" +13ms
vite:hmr /@modules/@pika/react-dom/source.development.js imports /@modules/@pika/react/source.development.js +32ms
vite:resolve (node_modules) @elastic/eui/es -> node_modules/@elastic/eui/es +184ms
vite:rewrite /src/logo.svg: no imports found. +9ms
Error: EISDIR: illegal operation on a directory, read
vite:rewrite /src/App.css: rewriting +13ms
vite:rewrite no imports rewritten. +0ms
vite:history not redirecting /favicon.ico (not accepting html) +0ms
vite:rewrite (skipped) /favicon.ico +29ms
vite:hmr ws client connected +2s
Activity
ais-one commentedon May 28, 2020
have you tried running it through snowpack? also quite a lot of UI Frameworks have the problem of needing webpack to work properly...
You might need to rely on browser builds instead (where you just include as script tag in the html)
You can try looking into web-components also
yyx990803 commentedon May 28, 2020
The entry issue is already fixed in 63b0e3c
But the bigger problem is
@elastic/euiassumes webpack so it does a lot of problematic things:react-is(which is a CJS dep)lodashcryptowhich is a node built-inIt only worked because webpack handles it, but this is just wrong. If you are shipping ESM you shouldn't depend on things that are actually CJS.
joshacheson commentedon May 28, 2020
@ais-one I did try snowpack, and it also wouldn't build (seems reasonable that even though the surfaced error was different the root cause was more or less the same).
@yyx990803 thank you for looking into this. It looks like I should use another build tool if I'm attached to
@elastic/eui.I feel bad for surfacing an example of what seems like an existential problem! If there's some way I can be helpful please let me know.
edit: I guess at the very least I will mention this to the
@elastic/euifolks but of course hold no expectation they'll work through this issue. Seems like it might be a doozy.yyx990803 commentedon May 28, 2020
I actually made it work by upgrading to
@rollup/plugin-commonjs12.0.0 but only when certain peer deps are deduped and placed in devDeps. Still trying to pinpoint the issue in the rollup plugin.yyx990803 commentedon May 28, 2020
With 2f071b3 it works but requires excluding
@elastic/eui's peer deps (in particularreact-is,prop-types) viaoptimizeDeps.exclude. There is a bug in@rollup/plugin-commonjsbeing tracked at rollup/plugins#424 but there's nothing else can be done on Vite's side.