-
-
Notifications
You must be signed in to change notification settings - Fork 129
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
fix: avoid double module hazard #552
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
I'll leave this for now and get back to it since the router example apparently is broken in dev:
|
not ready for review yet, just wanted to debug ci. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looking good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. Just one comment left.
); | ||
|
||
initialModules = Array.from(vite.moduleGraph.idToModuleMap.values()).map( | ||
(m) => ({ url: m.url, file: m.file! }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m.file!
Is there a case when m.file
is not defined? Just curious.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't find one!
There might be some issues in some edge cases, but hope @Aslemammad can fix it soon in that case. Let's merge it. |
Resolves #450
We warm up the vite module graph before serving the browser and the rsc tree, so at least for the initial module graph (main.tsx and its deps) we serve unified module paths (urls).
This way, we avoid the double module hazard hack we had before.
Later, we need also to do this for each request, rather than only for the initial request, so we avoid hmr main.tsx potential bugs.