Skip to content

Commit 79bc50c

Browse files
committed
docs: update section on route location
1 parent a2d0bab commit 79bc50c

File tree

3 files changed

+11
-13
lines changed

3 files changed

+11
-13
lines changed

docs/react/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ giget gh:fastify/fastify-vite/starters/react-kitchensink#dev your-app
8383

8484
All dependencies from **react-base**.
8585

86-
8786
## Known limitations
8887

8988
- It's currently impossible to run **multiple** Vite development servers, which means `@fastify/vite` can **only be registered once**. Vite's new [Environment API](https://vite.dev/guide/api-environment) was created to avoid this necessity.

docs/react/router-setup.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,13 @@ export defaut function MyPage () {
1818

1919
## Routes location
2020

21-
You can also change the glob pattern used to determine where to route modules from. Internally, this setting is passed to [Vite's glob importer](https://vitejs.dev/guide/features.html#glob-import).
21+
Internally, the route modules location is set via the `$app/routes.js` [virtual module](/react/project-structure#smart-imports), which is defined as follows by default:
22+
23+
```js
24+
export default import.meta.glob('/pages/**/*.{jsx,tsx}')
25+
```
26+
27+
To change the location where routes are loaded from, just place a `routes.js` file at your Vite project's root directory and `@fastify/react/plugin` will automatically recognize it and use it instead.
2228

2329
In your Vite configuration file:
2430

docs/vue/router-setup.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,14 @@ export const path = '/my-page'
2020

2121
## Routes location
2222

23-
You can also change the glob pattern used to determine where to route modules from. Internally, this setting is passed to [Vite's glob importer](https://vitejs.dev/guide/features.html#glob-import).
24-
25-
In your Vite configuration file:
23+
Internally, the route modules location is set via the `$app/routes.js` [virtual module](/vue/project-structure#smart-imports), which is defined as follows by default:
2624

2725
```js
28-
import viteFastifyVue from '@fastify/vue/plugin'
29-
30-
export default {
31-
plugins: [
32-
// ...
33-
viteFastifyVue({ globPattern: '/views/**/*.vue' }),
34-
]
35-
}
26+
export default import.meta.glob('/pages/**/*.vue')
3627
```
3728

29+
To change the location where routes are loaded from, just place a `routes.js` file at your Vite project's root directory and `@fastify/vue/plugin` will automatically recognize it and use it instead.
30+
3831
## Dynamic parameters
3932

4033
Dynamic route parameters uses `[param]` for a singular parameter and `[param+]` for wildcard routes.

0 commit comments

Comments
 (0)