Unverified Commit 04a164ff authored by Cong-Cong Pan's avatar Cong-Cong Pan Committed by GitHub

fix: Rspack not skip .d.ts file (#79285)

Next.js skips resolving `.d.ts` files. Rspack can achieve the same
behavior by adding the `resolve.restrictions: [/^(?!.*\.d\.ts$).*$/]`
configuration.

Following test cases will be passed:
- test/integration/typescript-paths/test/index.test.js
- typescript paths default behavior should not resolve to .d.ts files
- typescript paths without baseurl default behavior should not resolve
to .d.ts files
-
test/integration/typescript-workspaces-paths/packages/www/test/index.test.js
- TypeScript Features default behavior should not resolve to .d.ts files
parent dcd5ed0a
...@@ -779,6 +779,8 @@ export default async function getBaseWebpackConfig( ...@@ -779,6 +779,8 @@ export default async function getBaseWebpackConfig(
].filter(Boolean) as webpack.ResolvePluginInstance[], ].filter(Boolean) as webpack.ResolvePluginInstance[],
...((isRspack && jsConfigPath ...((isRspack && jsConfigPath
? { ? {
// Skip paths that are routed to a .d.ts file
restrictions: [/^(?!.*\.d\.ts$).*$/],
tsConfig: { tsConfig: {
configFile: jsConfigPath, configFile: jsConfigPath,
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment