Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions packages/compat/webpack/tests/__snapshots__/default.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -362,13 +362,13 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
},
"extensionAlias": {
".js": [
".js",
".ts",
".tsx",
".js",
],
".jsx": [
".tsx",
".jsx",
".tsx",
],
},
"extensions": [
Expand Down Expand Up @@ -769,13 +769,13 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when produ
},
"extensionAlias": {
".js": [
".js",
".ts",
".tsx",
".js",
],
".jsx": [
".tsx",
".jsx",
".tsx",
],
},
"extensions": [
Expand Down Expand Up @@ -1105,13 +1105,13 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
},
"extensionAlias": {
".js": [
".js",
".ts",
".tsx",
".js",
],
".jsx": [
".tsx",
".jsx",
".tsx",
],
},
"extensions": [
Expand Down Expand Up @@ -1424,13 +1424,13 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
},
"extensionAlias": {
".js": [
".js",
".ts",
".tsx",
".js",
],
".jsx": [
".tsx",
".jsx",
".tsx",
],
},
"extensions": [
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/plugins/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ export const pluginResolve = (): RsbuildPlugin => ({
// TypeScript allows importing TS files with `.js` extension
// See: https://github.com/microsoft/TypeScript/blob/c09e2ab4/src/compiler/moduleNameResolver.ts#L2151-L2168
chain.resolve.extensionAlias.merge({
'.js': ['.ts', '.tsx', '.js'],
'.jsx': ['.tsx', '.jsx'],
'.js': ['.js', '.ts', '.tsx'],
'.jsx': ['.jsx', '.tsx'],
});
}

Expand Down
16 changes: 8 additions & 8 deletions packages/core/tests/__snapshots__/default.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -388,13 +388,13 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
},
"extensionAlias": {
".js": [
".js",
".ts",
".tsx",
".js",
],
".jsx": [
".tsx",
".jsx",
".tsx",
],
},
"extensions": [
Expand Down Expand Up @@ -845,13 +845,13 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when prod
},
"extensionAlias": {
".js": [
".js",
".ts",
".tsx",
".js",
],
".jsx": [
".tsx",
".jsx",
".tsx",
],
},
"extensions": [
Expand Down Expand Up @@ -1200,13 +1200,13 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when targe
},
"extensionAlias": {
".js": [
".js",
".ts",
".tsx",
".js",
],
".jsx": [
".tsx",
".jsx",
".tsx",
],
},
"extensions": [
Expand Down Expand Up @@ -1633,13 +1633,13 @@ exports[`tools.rspack > should match snapshot 1`] = `
},
"extensionAlias": {
".js": [
".js",
".ts",
".tsx",
".js",
],
".jsx": [
".tsx",
".jsx",
".tsx",
],
},
"extensions": [
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-svelte/tests/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,13 @@ exports[`plugin-svelte > should add svelte loader and resolve config properly 2`
],
"extensionAlias": {
".js": [
".js",
".ts",
".tsx",
".js",
],
".jsx": [
".tsx",
".jsx",
".tsx",
],
},
"extensions": [
Expand Down
4 changes: 2 additions & 2 deletions website/docs/en/guide/basic/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ Rsbuild supports this feature through Rspack's [extensionAlias](https://rspack.d
const rspackConfig = {
resolve: {
extensionAlias: {
'.js': ['.ts', '.tsx', '.js'],
'.jsx': ['.tsx', '.jsx'],
'.js': ['.js', '.ts', '.tsx'],
'.jsx': ['.jsx', '.tsx'],
},
},
};
Expand Down
4 changes: 2 additions & 2 deletions website/docs/zh/guide/basic/typescript.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ Rsbuild 通过 Rspack 的 [extensionAlias](https://rspack.dev/config/resolve#res
const rspackConfig = {
resolve: {
extensionAlias: {
'.js': ['.ts', '.tsx', '.js'],
'.jsx': ['.tsx', '.jsx'],
'.js': ['.js', '.ts', '.tsx'],
'.jsx': ['.jsx', '.tsx'],
},
},
};
Expand Down
Loading