Repository navigation
fix(react-email): resolve aliased dynamic import directories on Windows - #3799
Open
sachinkr7368 wants to merge 1 commit into
Open
sachinkr7368 wants to merge 1 commit into
sachinkr7368 wants to merge 1 commit into
Conversation
resolveDynamicImportDirectory normalized the template literal prefix with path.normalize(), which on Windows rewrites '@/locales/' as '@\locales\'. That prefix then reaches tsconfig-paths' matchPath, whose '@/*' patterns only match forward slashes, so the lookup returned undefined and the aliased directory was never watched. Restore import specifier separators before matching the tsconfig paths.
🦋 Changeset detectedLatest commit: 1546a19 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
@sachinkr7368 is attempting to deploy a commit to the resend Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3796.
resolveDynamicImportDirectorynormalizes the template literal prefix withpath.normalize(). On Windows that rewrites"@/locales/"as"@\\locales\\", and the trimmed prefix is then handed totsconfig-paths'matchPath. Patterns like"@/*"only match forward slashes, so the lookup returnsundefined, the aliased directory is never added todynamicDependencyDirectories, and edits inside it emit no reload.This restores import specifier separators before matching the configured paths. Relative prefixes are unaffected, since they still go through
path.resolve().Verification
Added
resolveAliasedDirectoryPrefix() accepts platform-normalized separators, which covers both separators explicitly:Without the fix the Windows-shaped call returns
undefined:Passing with the fix:
vitest run src/cli/utils/preview/hot-reloading— 24 passed (includes the existing alias and alias-fallback graph tests from feat(react-email): hot reloading around dynamic import #3422)biome check— cleanThe wider package suite in this checkout fails to resolve unbuilt workspace packages (
@react-email/render), which is unrelated to this change.Credit
The reproduction and root-cause analysis in #3796 are from @MokiMeow. I have only applied the one-line separator normalization and added the regression test they described.
Prepared with AI assistance (OpenCode).
Summary by cubic
Fixes preview hot-reloading on Windows so edits to files inside tsconfig-path-aliased directories trigger a reload.
On Windows,
path.normalize()converts import specifier separators to backslashes (@/locales/becomes@\locales\), andtsconfig-pathspatterns like"@/*"only match forward slashes, so the aliased directory was never added to the watched set. The prefix separators are now restored to forward slashes before matching, with a regression test covering both separator forms.Written for commit 1546a19. Summary will update on new commits.