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

Vite 3 regression: missing reload after fixing import error existing on dev server startup #9534

Closed
7 tasks done
fwouts opened this issue Aug 4, 2022 · 0 comments · Fixed by #10602
Closed
7 tasks done
Labels
feat: deps optimizer Esbuild Dependencies Optimization feat: hmr p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@fwouts
Copy link
Contributor

fwouts commented Aug 4, 2022

Describe the bug

When spinning up the Vite dev server with code that contains an invalid import, an error is shown as expected. However, fixing the code does not cause the page to reload as it should. It needs to be reloaded manually.

This only seems to occur when the invalid import was present when the Vite dev server was first spun up. I suspect that's because Vite 3 doesn't set up the module graph in the same way as Vite 2 did, i.e. a file that contains a bad import isn't added to the module graph, so when that file is updated, Vite 3's dev server doesn't know about it and therefore no reload occurs.

I found out about it when upgrading Preview.js to Vite 3, as I have tests for that specific case. Yes, I'm considering adding it to the ecosystem test suite, but it's too flaky at the moment :)

Reproduction

https://github.com/fwouts/vite-not-refreshing (reproduction steps in README)

System Info

System:
    OS: macOS 12.5
    CPU: (8) arm64 Apple M1
    Memory: 119.88 MB / 8.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.15.0 - ~/.nvm/versions/node/v16.15.0/bin/node
    Yarn: 1.22.19 - ~/.yarn/bin/yarn
    npm: 8.9.0 - ~/.config/yarn/global/node_modules/.bin/npm
  Browsers:
    Chrome: 103.0.5060.134
    Firefox: 103.0
    Safari: 15.6
  npmPackages:
    vite: ^3.0.0 => 3.0.4

Used Package Manager

pnpm

Logs

No response

Validations

@sapphi-red sapphi-red added feat: hmr p3-minor-bug An edge case that only affects very specific usage (priority) feat: deps optimizer Esbuild Dependencies Optimization labels Aug 5, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Nov 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: deps optimizer Esbuild Dependencies Optimization feat: hmr p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants