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(react-server): fix ?import query dual package when client module is used at both boundary and non-boundary #315

Merged
merged 7 commits into from
May 14, 2024

Conversation

hi-ogawa
Copy link
Owner

@hi-ogawa hi-ogawa commented May 14, 2024

The external deps was handled by the virtual module wrapper:

but internal client code still becomes dual package since the one imported at client boundary (e.g. GlobalProgress imported by server component Header) will have <id>?import due to import(/* @vite-ignore */ id), but the one imported not at the boundary (e.g. GlobalProgress imported by client component Counter) will be simply <id> since it'll go through normal import analysis transform.

To avoid this, we can simply expose import wrapper as inline script so it won't go through Vite transform.
(see also hi-ogawa/vite-environment-examples#69)


Hmm, this scenario still makes dual package after HMR since client component will imports the one with <id>?t=... but server component has reference with <id>. But I guess that's a separate problem already existed before. For now, I added this issue to TODO list #174

todo

  • test
    • context demo

@hi-ogawa hi-ogawa mentioned this pull request May 14, 2024
69 tasks
@hi-ogawa hi-ogawa changed the title chore(react-server): reproduce dual package with and without ?import chore(react-server): reproduce dual package of local dep with and without ?import May 14, 2024
@hi-ogawa hi-ogawa changed the title chore(react-server): reproduce dual package of local dep with and without ?import fix(react-server): fix ?import query dual package May 14, 2024
@hi-ogawa hi-ogawa changed the title fix(react-server): fix ?import query dual package fix(react-server): fix ?import query dual package when client module used at both boundary and non-boundary May 14, 2024
@hi-ogawa hi-ogawa changed the title fix(react-server): fix ?import query dual package when client module used at both boundary and non-boundary fix(react-server): fix ?import query dual package when client module is used at both boundary and non-boundary May 14, 2024
@hi-ogawa hi-ogawa marked this pull request as ready for review May 14, 2024 03:32
@hi-ogawa hi-ogawa merged commit ea5f7ef into main May 14, 2024
4 checks passed
@hi-ogawa hi-ogawa deleted the chore-repro-import-dual-package branch May 14, 2024 03:45
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.

1 participant