You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`Failed to resolve module ${color.green(`"${request}"`)} from ${color.green(issuer)}. If it's an npm package, consider adding it to dependencies or peerDependencies in package.json to make it externalized.`,
Whether to automatically redirect the file extension to import paths based on the TypeScript declaration output files.
272
+
Whether to automatically redirect the file extension of import paths based on the TypeScript declaration output files.
273
273
274
-
- When set to `true`, the import paths in declaration files will be redirected to the corresponding JavaScript extension which can be resolved to corresponding declaration file. The extension of the declaration output file is related to the `dtsExtension` configuration.
274
+
- When set to `true`, the file extension of the import path in the declaration file will be automatically completed or replaced with the corresponding JavaScript file extension that can be resolved to the corresponding declaration file. The extension of the declaration output file is related to the `dtsExtension` configuration.
275
275
276
276
```ts
277
277
// `dtsExtension` is set to `.d.mts`
@@ -282,7 +282,7 @@ import { foo } from './foo.ts'; // source code of './src/bar.ts' ↓
282
282
import { foo } from'./foo.mjs'; // expected output of './dist/bar.d.mts'
283
283
```
284
284
285
-
- When set to `false`, the file extension will remain unchanged from the original import path in the rewritten import path of the output file (regardless of whether it is specified or specified as any value).
285
+
- When set to `false`, import paths will retain their original file extensions.
Copy file name to clipboardExpand all lines: website/docs/en/config/lib/redirect.mdx
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,7 +85,7 @@ Whether to automatically redirect the import paths of JavaScript output files.
85
85
-**Type:**`boolean`
86
86
-**Default:**`true`
87
87
88
-
When set to `true`, [resolve.alias](/config/rsbuild/resolve#resolvealias) and [resolve.aliasStrategy](/config/rsbuild/resolve#aliasstrategy) will take effect and applied in the rewritten import path of the output file. For TypeScript projects, just configure [compilerOptions.paths](https://typescriptlang.org/tsconfig#paths) in the `tsconfig.json` file.
88
+
When set to `true`, [resolve.alias](/config/rsbuild/resolve#resolvealias) and [resolve.aliasStrategy](/config/rsbuild/resolve#aliasstrategy) will take effect in the output file, and the import path of the output file will be rewritten. For TypeScript projects, just configure [compilerOptions.paths](https://typescriptlang.org/tsconfig#paths) in the `tsconfig.json` file.
89
89
90
90
When set to `false`, the import path will not be effected by [resolve.alias](/config/rsbuild/resolve#resolvealias), [resolve.aliasStrategy](/config/rsbuild/resolve#aliasstrategy) and `tsconfig.json`.
Whether to automatically redirect the file extension to import paths based on the JavaScript output files.
106
+
Whether to automatically redirect the file extension of import paths based on the JavaScript output files.
107
107
108
108
-**Type:**`boolean`
109
109
-**Default:**`true`
110
110
111
-
When set to `true`, the file extension will automatically be added to the rewritten import path of the output file, regardless of the original extension or whether it is specified in the import path.
111
+
When set to `true`, the file extension of import paths in JavaScript output files that can be resolved correctly will be automatically completed or replaced.
112
112
113
-
When set to `false`, the file extension will remain unchanged from the original import path in the rewritten import path of the output file (regardless of whether it is specified or specified as any value).
113
+
When set to `false`, import paths will retain their original file extensions.
114
114
115
115
:::note
116
116
The extension of the JavaScript output file is related to the [autoExtension](/config/lib/auto-extension#libautoextension) configuration.
@@ -167,7 +167,7 @@ import styles from '../foo.css'; // expected output of './dist/utils/index.js'
167
167
168
168
### redirect.style.extension
169
169
170
-
Whether to automatically redirect the file extension to import paths based on the style output files.
170
+
Whether to automatically redirect the file extension of import paths based on the style output files.
171
171
172
172
-**Type:**`boolean`
173
173
-**Default:**`true`
@@ -215,7 +215,7 @@ import url from './assets/logo.svg'; // expected output of './dist/foo.js'
215
215
216
216
### redirect.asset.extension
217
217
218
-
Whether to automatically redirect the file extension to import paths based on the asset output files.
218
+
Whether to automatically redirect the file extension of import paths based on the asset output files.
Whether to automatically redirect the file extension to import paths based on the TypeScript declaration output files.
269
+
Whether to automatically redirect the file extension of import paths based on the TypeScript declaration output files.
270
270
271
271
-**Type:**`boolean`
272
272
-**Default:**`false`
273
273
274
-
When set to `true`, the import paths in declaration files will be redirected to the corresponding JavaScript extension which can be resolved to corresponding declaration file.
274
+
When set to `true`, the file extension of the import path in the declaration file will be automatically completed or replaced with the corresponding JavaScript file extension that can be resolved to the corresponding declaration file.
275
275
276
-
When set to `false`, the file extension will remain unchanged from the original import path in the rewritten import path of the output file (regardless of whether it is specified or specified as any value).
276
+
When set to `false`, import paths will retain their original file extensions.
277
277
278
278
:::note
279
279
The extension of the TypeScript declaration file is related to the [dts.autoExtension](/config/lib/dts#dtsautoextension) configuration.
280
280
:::
281
281
282
282
-**Example:**
283
283
284
-
For the `.d.mts` declaration file, in some scenarios, the full extension of the module import path is needed to load correctly.
284
+
When loading a module with `moduleResolution: 'nodenext'`, the import path needs to include the full file extension. Rslib will automatically add the corresponding file extension based on the actual JavaScript output file.
0 commit comments