docs: updates for breaking changes (#9558)
- Update modules registration - Update `medusa-config.js` to `medusa-config.ts` - Update the out directory in the admin deployment guide - Update logger imports - Other fixes Note: will need to re-generate references afterwards Closes #9548
This commit is contained in:
@@ -118,37 +118,29 @@ export default Module(HELLO_MODULE, {
|
||||
|
||||
You use the `Module` function imported from `@medusajs/framework/utils` to create the module's definition. It accepts two parameters:
|
||||
|
||||
1. The module's name.
|
||||
1. The name that the module's main service is registered under (`helloModuleService`).
|
||||
2. An object with a required property `service` indicating the module's main service.
|
||||
|
||||
### 4. Add Module to Configurations
|
||||
|
||||
The last step is to add the module in Medusa’s configurations.
|
||||
|
||||
In `medusa-config.js`, add a `modules` property and pass to it your custom module:
|
||||
In `medusa-config.ts`, add a `modules` property and pass in it your custom module:
|
||||
|
||||
```js title="medusa-config.js" highlights={[["6", "helloModuleService", "The key of the main service to be registered in the Medusa container."]]}
|
||||
```ts title="medusa-config.ts" highlights={[["6", "helloModuleService", "The key of the main service to be registered in the Medusa container."]]}
|
||||
module.exports = defineConfig({
|
||||
projectConfig: {
|
||||
// ...
|
||||
},
|
||||
modules: {
|
||||
helloModuleService: {
|
||||
modules: [
|
||||
{
|
||||
resolve: "./modules/hello",
|
||||
},
|
||||
},
|
||||
}
|
||||
]
|
||||
})
|
||||
```
|
||||
|
||||
The key `helloModuleService` is the name of the module’s main service. It will be registered in the Medusa container with that name.
|
||||
|
||||
<Note>
|
||||
|
||||
The key must be the same value passed as the first parameter to the `Module` function in the module's definition.
|
||||
|
||||
</Note>
|
||||
|
||||
Its value is an object having the `resolve` property, whose value is either a path to module's directory relative to `src` (it shouldn't include `src` in the path), or an `npm` package’s name.
|
||||
Its value is an array of objects, each having a `resolve` property, whose value is either a path to module's directory relative to `src` (it shouldn't include `src` in the path), or an `npm` package’s name.
|
||||
|
||||
### 5. Generate Migrations
|
||||
|
||||
|
||||
Reference in New Issue
Block a user