Skip to content

Commit 4058537

Browse files
committed
refactor!(config): remove route.extensions
1 parent 7e6cb65 commit 4058537

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

packages/document/docs/en/api/config/config-basic.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,16 +435,16 @@ export default defineConfig({
435435
### route.extensions
436436

437437
- Type: `string[]`
438-
- Default: `['.js', '.jsx', '.ts', '.tsx', '.md', '.mdx']`
438+
- Default: `['.md', '.mdx']`
439439

440-
The extensions of the files that will be included in the route. By default, Rspress will include all `'js'`, `'jsx'`, `'ts'`, `'tsx'`, `'md'`, `'mdx'` files in the route. If you want to customize the extensions, you can use this option. For example:
440+
The extensions of the files that will be included in the route. By default, Rspress will include all `.md`, `.mdx` files in the route. If you want to customize the extensions, you can use this option. For example:
441441

442442
```js
443443
import { defineConfig } from 'rspress/config';
444444

445445
export default defineConfig({
446446
route: {
447-
extensions: ['.md', '.mdx'],
447+
extensions: ['.md', '.mdx', '.markdown', '.MD'],
448448
},
449449
});
450450
```

packages/document/docs/zh/api/config/config-basic.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,16 +434,16 @@ export default defineConfig({
434434
### route.extensions
435435

436436
- Type: `string[]`
437-
- Default: `['.js', '.jsx', '.ts', '.tsx', '.md', '.mdx']`
437+
- Default: `['.md', '.mdx']`
438438

439-
将包含在路由中的文件的扩展名。默认情况下,Rspress 会在路由中包含所有 `'js'、'jsx'、'ts'、'tsx'、'md'、'mdx' 文件。如果你想自定义扩展名,你可以使用这个选项。例如:
439+
将包含在路由中的文件的扩展名。默认情况下,Rspress 会扫描在 [`base`](#base) 下的所有 `.md``.mdx` 文件。如果你想自定义扩展名,你可以使用这个选项。例如:
440440

441441
```js title="rspress.config.ts"
442442
import { defineConfig } from 'rspress/config';
443443

444444
export default defineConfig({
445445
route: {
446-
extensions: ['.md', '.mdx'],
446+
extensions: ['.md', '.mdx', '.markdown', '.MD'],
447447
},
448448
});
449449
```

packages/shared/src/constants.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,4 @@ export const DEFAULT_CONFIG_EXTENSIONS = [
99
'.cts',
1010
] as const;
1111

12-
export const DEFAULT_PAGE_EXTENSIONS = [
13-
'.js',
14-
'.jsx',
15-
'.ts',
16-
'.tsx',
17-
'.md',
18-
'.mdx',
19-
];
12+
export const DEFAULT_PAGE_EXTENSIONS = ['.md', '.mdx'];

0 commit comments

Comments
 (0)