mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 07:05:11 +00:00
docs: add module execution order (#27178)
This commit is contained in:
parent
89baee0493
commit
341fbe60f9
@ -46,7 +46,11 @@ export default defineEventHandler(() => {
|
||||
|
||||
When starting Nuxt, the `hello` module will be registered and the `/api/hello` route will be available.
|
||||
|
||||
Local modules are registered in alphabetical order. You can change the order by adding a number to the front of each directory name:
|
||||
Modules are executed in the following sequence:
|
||||
- First, the modules defined in [`nuxt.config.ts`](/docs/api/nuxt-config#modules-1) are loaded.
|
||||
- Then, modules found in the `modules/` directory are executed, and they load in alphabetical order.
|
||||
|
||||
You can change the order of local module by adding a number to the front of each directory name:
|
||||
|
||||
```bash [Directory structure]
|
||||
modules/
|
||||
|
@ -236,7 +236,8 @@ export default defineUntypedSchema({
|
||||
*
|
||||
* Nuxt tries to resolve each item in the modules array using node require path
|
||||
* (in `node_modules`) and then will be resolved from project `srcDir` if `~` alias is used.
|
||||
* @note Modules are executed sequentially so the order is important.
|
||||
* @note Modules are executed sequentially so the order is important. First, the modules defined in `nuxt.config.ts` are loaded. Then, modules found in the `modules/`
|
||||
* directory are executed, and they load in alphabetical order.
|
||||
* @example
|
||||
* ```js
|
||||
* modules: [
|
||||
|
Loading…
Reference in New Issue
Block a user