From 3320f13f5aa42919b8254a9b676b9ab753c2ab98 Mon Sep 17 00:00:00 2001 From: Mohmmed Aqeeb <104136004+aqeebpathan@users.noreply.github.com> Date: Mon, 23 Sep 2024 19:25:32 +0530 Subject: [PATCH] Fix: Correct module path and clarify config structure in Medusa v2 Docs (#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! --- www/apps/book/app/basics/modules-and-services/page.mdx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/www/apps/book/app/basics/modules-and-services/page.mdx b/www/apps/book/app/basics/modules-and-services/page.mdx index 500030b129..b780ede382 100644 --- a/www/apps/book/app/basics/modules-and-services/page.mdx +++ b/www/apps/book/app/basics/modules-and-services/page.mdx @@ -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", @@ -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,