Skip to content

Commit bfb7ce2

Browse files
committed
docs: Updates extends docs
1 parent 25609cf commit bfb7ce2

File tree

6 files changed

+46
-0
lines changed

6 files changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
---
2+
title: Extends
3+
description: How extends modules
4+
navigation.icon: i-lucide-git-fork
5+
---
6+
7+
`extends` is a feature that allows your application to "inherit" functionality from other modules.
8+
9+
This enables you to distribute and organize your entire application in a fully modular way.
10+
11+
You can simply have a single module that extends all the other modules required by your application.
12+
13+
## How create a module
14+
15+
Just run
16+
17+
```bash
18+
pnpm create reactmos main-module
19+
```
20+
21+
## How extends
22+
23+
You can extend a module by specifying it in the `module.config.ts` file.
24+
25+
```ts
26+
export default {
27+
moduleName: 'main-module',
28+
extends: [
29+
'auth-module', // You can a use a published module
30+
'../blog-module' // You can use a relative path to another module
31+
]
32+
}
33+
```
34+
35+
::tip
36+
You can extend a module published in a registry, or simply use a relative path to the module you want to extend.
37+
::
38+
39+
40+
::warning
41+
When using a relative path, you must have the dependencies of the extended module installed in your project.
42+
::
43+
44+
## What is inherit
45+
46+
The main thing inherited from extended modules is their routes. Functions, methods, components, and other values can be shared through the `extras` option in `module.config.ts` and accessed using the `getExtras` helper function. You can see how [here](/features/extra-configs)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)