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

fix: avoid double module hazard #552

Merged
merged 110 commits into from
Mar 15, 2024
Merged

fix: avoid double module hazard #552

merged 110 commits into from
Mar 15, 2024

Conversation

Aslemammad
Copy link
Contributor

@Aslemammad Aslemammad commented Feb 29, 2024

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.

Copy link

vercel bot commented Feb 29, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
waku ✅ Ready (Inspect) Visit Preview Mar 15, 2024 6:40am

Copy link

codesandbox-ci bot commented Feb 29, 2024

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.

@Aslemammad
Copy link
Contributor Author

I'll leave this for now and get back to it since the router example apparently is broken in dev:

hey daishi, i guess the 07_router example is broken in dev, could you verify please? it returns html for js files like main.tsx

@Aslemammad
Copy link
Contributor Author

not ready for review yet, just wanted to debug ci.

Copy link
Owner

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking good.

packages/waku/src/lib/renderers/dev-worker-impl.ts Outdated Show resolved Hide resolved
packages/waku/src/lib/renderers/html-renderer.ts Outdated Show resolved Hide resolved
Copy link
Owner

@dai-shi dai-shi left a 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.

@Aslemammad Aslemammad marked this pull request as ready for review March 15, 2024 06:25
);

initialModules = Array.from(vite.moduleGraph.idToModuleMap.values()).map(
(m) => ({ url: m.url, file: m.file! }),
Copy link
Owner

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.

Copy link
Contributor Author

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!

@dai-shi
Copy link
Owner

dai-shi commented Mar 15, 2024

There might be some issues in some edge cases, but hope @Aslemammad can fix it soon in that case. Let's merge it.

@dai-shi dai-shi merged commit b96112f into dai-shi:main Mar 15, 2024
28 checks passed
@Aslemammad Aslemammad deleted the fix/450 branch March 15, 2024 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor to avoid dual module hacks
2 participants