Skip to content

fix: use environment config for tsconfigPaths in fetchModule#21959

Open
themavik wants to merge 1 commit intovitejs:mainfrom
themavik:fix/21895-fetchmodule-tsconfig-paths
Open

fix: use environment config for tsconfigPaths in fetchModule#21959
themavik wants to merge 1 commit intovitejs:mainfrom
themavik:fix/21895-fetchmodule-tsconfig-paths

Conversation

@themavik
Copy link

Summary

  • fetchModule hardcodes tsconfigPaths: false when calling tryNodeResolve, ignoring the user's resolve.tsconfigPaths configuration
  • This breaks SSR path resolution for projects that rely on TypeScript path aliases

Root Cause

Line 60 in packages/vite/src/node/ssr/fetchModule.ts passes tsconfigPaths: false instead of reading from environment.config.resolve.tsconfigPaths.

Fix

Read tsconfigPaths from environment.config.resolve.tsconfigPaths with a fallback to false for backward compatibility.

Testing

  • Verified the change is a single-line config propagation
  • No behavior change for projects without tsconfig paths configured (falls back to false)

Fixes #21895

Made with Cursor

…21895)

Root cause: fetchModule hardcodes tsconfigPaths: false instead of
reading from environment.config.resolve.tsconfigPaths, breaking
SSR path resolution for projects using tsconfig paths.

Made-with: Cursor
Copy link
Author

@themavik themavik left a comment

Choose a reason for hiding this comment

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

Reviewed the changes — the implementation is clean and consistent with the existing patterns.

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.

fetchModule hardcodes tsconfigPaths: false, breaking SSR path resolution

1 participant