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

Module graph doesn't track new files that were previously missing #10663

Closed
7 tasks done
bluwy opened this issue Oct 27, 2022 · 1 comment · Fixed by #16303
Closed
7 tasks done

Module graph doesn't track new files that were previously missing #10663

bluwy opened this issue Oct 27, 2022 · 1 comment · Fixed by #16303
Labels
feat: hmr p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@bluwy
Copy link
Member

bluwy commented Oct 27, 2022

Describe the bug

When File A imports a non-existent File B like import { foo } from './file_b', and later we create file_b.js to fix it, Vite doesn't pick up this new change and reload the page.

Note:

  • Happens in both client and SSR.

Workaround:

  • Client: Refresh the page.
  • Server: Update File A with a fake change and Ctrl+S. (because of ssrError cache in the module graph)

Potential fix:

  • Keep a shell module if an import doesn't exist so we have a direct link to the non-existent file upon creation.
  • OR when a new file is created, update all modules that are in an error state.

Reproduction

https://stackblitz.com/edit/vitejs-vite-biac4m?file=_foo.js,main.js&terminal=dev

Steps to reproduce

main.js imports _foobar which doesn't exist.

  1. Rename _foo.js to _foobar.js to fix it.
  2. Notice that the page doesn't reload.

System Info

Stackblitz

Used Package Manager

npm

Logs

No response

Validations

@bluwy bluwy added pending triage feat: hmr p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Oct 27, 2022
@tuchg
Copy link
Contributor

tuchg commented Nov 4, 2022

related #10602

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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