Skip to content
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

ENOENT error with Vite in dev mode #1246

Closed
nstepien opened this issue May 6, 2023 · 4 comments · Fixed by #1350
Closed

ENOENT error with Vite in dev mode #1246

nstepien opened this issue May 6, 2023 · 4 comments · Fixed by #1350
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked bundler: webpack 📦 Issue is related to webpack bundler needs: complete repro 🖥️ Issue need to have complete repro provided platform: ssr 🛠️ Issue related to SSR

Comments

@nstepien
Copy link
Contributor

nstepien commented May 6, 2023

Environment

  • Linaria version: @linaria/vite@4.2.11
  • Bundler (+ version): vite@4.3.5
  • Node.js version: 20.1.0
  • OS: win11

Description

When running the Vite dev server, linaria can crash trying to open a file that does not exist yet.
In this case, as I understand it, Vite replaces core-js imports with an optimized file, but linaria tries to open that optimized file before it has been created.
If reload the page, then the optimized file will have been created and linaria won't crash anymore.

Reproducible Demo

https://github.com/nstepien/vite-bug/tree/vite-linaria-corejs
Clone the repo, checkout the vite-linaria-corejs branch, npm ci
npm run dev -> crash -> reload page in browser -> works

You can reproduce the bug again by deleting node_modules/.vite/

@nstepien nstepien added bug report 🦗 Issue is probably a bug, but it needs to be checked needs: complete repro 🖥️ Issue need to have complete repro provided needs: triage 🏷 Issue needs to be checked and prioritized labels May 6, 2023
@github-actions github-actions bot added bundler: webpack 📦 Issue is related to webpack bundler platform: ssr 🛠️ Issue related to SSR and removed needs: triage 🏷 Issue needs to be checked and prioritized labels May 6, 2023
@silviogutierrez
Copy link
Contributor

I'm having the same issue, seems to be some sort of race condition. But even moving the plugins around did not help.

@nstepien
Copy link
Contributor Author

Still happening, I've updated the branch with the latest version of linaria/vite.

@layershifter
Copy link
Contributor

Still happens with v5, needs to be fixed.

@layershifter
Copy link
Contributor

Created an issue in Vite to find a proper solution, vitejs/vite#14493.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report 🦗 Issue is probably a bug, but it needs to be checked bundler: webpack 📦 Issue is related to webpack bundler needs: complete repro 🖥️ Issue need to have complete repro provided platform: ssr 🛠️ Issue related to SSR
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants