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 patching global webpack require #707

Merged
merged 27 commits into from
Jul 2, 2024
Merged

fix: avoid patching global webpack require #707

merged 27 commits into from
Jul 2, 2024

Conversation

dai-shi
Copy link
Owner

@dai-shi dai-shi commented May 9, 2024

close #579

  • prd
  • dev

Copy link

vercel bot commented May 9, 2024

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

Name Status Preview Updated (UTC)
waku ✅ Ready (Inspect) Visit Preview Jul 1, 2024 11:50pm

Copy link

codesandbox-ci bot commented May 9, 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.

@dai-shi dai-shi marked this pull request as ready for review July 1, 2024 14:46
@@ -79,10 +77,13 @@ ${opts.htmlHead}
},
transformIndexHtml() {
return [
// HACK: vite won't inject __vite__injectQuery anymore
Copy link
Owner Author

Choose a reason for hiding this comment

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

@Aslemammad What does it mean???

Copy link
Contributor

Choose a reason for hiding this comment

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

Vite optimizes import() so it adds ?import to imported urls. That'd cause double module hazard!

This way, I hack it to use a global function so it does not get optimized.

if (id === 'waku' || id.startsWith('waku/')) {
// HACK I don't know why this is necessary.
// `external: ['waku']` doesn't somehow work?
return import(id);
Copy link
Contributor

Choose a reason for hiding this comment

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

Tbh, it does not feel right! I'd rather figure out how we can move default handler to use ssrLoadModule, that'd be way more robust, I guess.

But this can work too.

Copy link
Owner Author

@dai-shi dai-shi Jul 1, 2024

Choose a reason for hiding this comment

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

move default handler to use ssrLoadModule

@Aslemammad Do you have time to try it?

I will merge this PR, so please open a new PR.

@dai-shi dai-shi merged commit fe20737 into main Jul 2, 2024
28 checks passed
@dai-shi dai-shi deleted the hack-webpack branch July 2, 2024 01:05
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.

3 participants