Skip to content

Commit

Permalink
Fix: Correct module path and clarify config structure in Medusa v2 Do…
Browse files Browse the repository at this point in the history
…cs (#9222)

### What
This PR addresses an issue in the Medusa v2 documentation regarding the module creation example. The import paths were corrected to reflect the proper directory structure, ensuring clarity for users.

Closes #9220 

### Why
The previous documentation contained incorrect import paths that could lead to confusion for users attempting to create and configure modules. Clarifying the structure aims to prevent similar issues for future users.

### How
- Updated the import statements in the documentation to go two levels up instead of three.
- Added clarification in the `medusa-config.js` example to indicate that the `modules` node should be a part of `projectConfig`.

### Testing
While documentation changes do not require formal testing, I reviewed the updated paths and descriptions against the current code structure to ensure accuracy and clarity.

### Note
This is my first contribution to an open source project, and I'm excited to contribute to the Medusa community!
  • Loading branch information
aqeebpathan authored Sep 23, 2024
1 parent 8ec323b commit 3320f13
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions www/apps/book/app/basics/modules-and-services/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ 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:

```js title="medusa-config.js" highlights={[["4", "helloModuleService", "The key of the main service to be registered in the Medusa container."]]}
```js title="medusa-config.js" highlights={[["7", "helloModuleService", "The key of the main service to be registered in the Medusa container."]]}
module.exports = defineConfig({
// ...
projectConfig: {
// ...
},
modules: {
helloModuleService: {
resolve: "./modules/hello",
Expand Down Expand Up @@ -109,8 +111,8 @@ For example, create the API route `src/api/custom/route.ts` with the following c

```ts title="src/api/custom/route.ts"
import { MedusaRequest, MedusaResponse } from "@medusajs/medusa"
import HelloModuleService from "../../../modules/hello/service"
import { HELLO_MODULE } from "../../../modules/hello"
import HelloModuleService from "../../modules/hello/service"
import { HELLO_MODULE } from "../../modules/hello"

export async function GET(
req: MedusaRequest,
Expand Down

0 comments on commit 3320f13

Please sign in to comment.