docs: use require instead of import in medusa-config.js (#9102)

Co-authored-by: Carlos R. L. Rodrigues <37986729+carlos-r-l-rodrigues@users.noreply.github.com>
This commit is contained in:
Shahed Nasser
2024-09-16 19:34:00 +02:00
committed by GitHub
co-authored by Carlos R. L. Rodrigues
parent 58f06be44d
commit 8d3fb7fb2b
29 changed files with 29 additions and 31 deletions
@@ -153,7 +153,7 @@ To use your Cache Module, add it to the `modules` object exported as part of the
For example: For example:
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -37,7 +37,7 @@ Make sure that the version added in `package.json` is `preview` to avoid errors
Next, add the module into the `modules` property of the exported object in `medusa-config.js`: Next, add the module into the `modules` property of the exported object in `medusa-config.js`:
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -38,7 +38,7 @@ export const highlights = [
] ]
```js title="medusa-config.js" highlights={highlights} ```js title="medusa-config.js" highlights={highlights}
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -108,7 +108,7 @@ To use your Event Module, add it to the `modules` object exported as part of the
For example: For example:
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -35,7 +35,7 @@ Make sure that the version added in `package.json` is `preview` to avoid errors
Next, add the module into the `modules` property of the exported object in `medusa-config.js`: Next, add the module into the `modules` property of the exported object in `medusa-config.js`:
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -42,7 +42,7 @@ export const highlights = [
] ]
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -45,7 +45,7 @@ The File Module accepts one provider only.
</Note> </Note>
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -119,7 +119,7 @@ The File Module accepts one provider only.
</Note> </Note>
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -39,7 +39,7 @@ Only one provider can be defined for a channel.
</Note> </Note>
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -31,7 +31,7 @@ When you send a notification, you specify the channel to send it through, such a
For example: For example:
```js title="medusa-config.js" highlights={[["19"]]} ```js title="medusa-config.js" highlights={[["19"]]}
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -50,7 +50,7 @@ Only one provider can be defined for a channel.
</Note> </Note>
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -37,7 +37,7 @@ Make sure that the version added in `package.json` is `preview` to avoid errors
Next, add the module into the `modules` property of the exported object in `medusa-config.js`: Next, add the module into the `modules` property of the exported object in `medusa-config.js`:
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -38,7 +38,7 @@ export const highlights = [
] ]
```js title="medusa-config.js" highlights={highlights} ```js title="medusa-config.js" highlights={highlights}
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -19,7 +19,7 @@ The Emailpass auth provider is registered by default with the Auth Module.
If you want to pass options to the provider, add the provider to the `providers` option of the Auth Module: If you want to pass options to the provider, add the provider to the `providers` option of the Auth Module:
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -42,7 +42,7 @@ npm install @medusajs/auth-github@preview
Next, add the module to the array of providers passed to the Auth Module: Next, add the module to the array of providers passed to the Auth Module:
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -42,7 +42,7 @@ npm install @medusajs/auth-google@preview
Next, add the module to the array of providers passed to the Auth Module: Next, add the module to the array of providers passed to the Auth Module:
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -21,7 +21,7 @@ When the Medusa application starts, these providers are registered and can be us
For example: For example:
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -21,7 +21,7 @@ When the Medusa application starts, these providers are registered and can be us
For example: For example:
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -102,7 +102,7 @@ When the Medusa application starts, these providers are registered and can be us
For example: For example:
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -52,7 +52,7 @@ Make sure that the version added in `package.json` is `preview` to avoid errors
Next, add the module to the array of providers passed to the Payment Module: Next, add the module to the array of providers passed to the Payment Module:
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -19,7 +19,7 @@ The `providers` option is an array of either tax module providers, tax plugins,
When the Medusa application starts, these providers are registered and can be used to retrieve tax lines. When the Medusa application starts, these providers are registered and can be used to retrieve tax lines.
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -15,7 +15,7 @@ In this document, you'll learn about the options of the User Module.
## Module Options ## Module Options
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -143,7 +143,7 @@ For example, add the following dependencies in `package.json` for the Cache, Eve
Then, add these modules in `medusa-config.js`: Then, add these modules in `medusa-config.js`:
```js title="medusa-config.js" ```js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
module.exports = defineConfig({ module.exports = defineConfig({
// ... // ...
@@ -1506,9 +1506,7 @@ Finally, register the module provider in `medusa-config.js`:
```js title="medusa-config.js" ```js title="medusa-config.js"
// other imports... // other imports...
import { const { Modules } = require("@medusajs/utils")
Modules,
} from "@medusajs/utils"
module.exports = defineConfig({ module.exports = defineConfig({
modules: { modules: {
@@ -51,7 +51,7 @@ This exports the module's definition, indicating that the \`MyAuthProviderServic
To use your Auth Module Provider, add it to the \`providers\` array of the Auth Module: To use your Auth Module Provider, add it to the \`providers\` array of the Auth Module:
\`\`\`js title="medusa-config.js" \`\`\`js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -57,7 +57,7 @@ The File Module accepts one provider only.
</Note> </Note>
\`\`\`js title="medusa-config.js" \`\`\`js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -51,7 +51,7 @@ This exports the module's definition, indicating that the \`MyFulfillmentProvide
To use your Fulfillment Module Provider, add it to the \`providers\` array of the Fulfillment Module: To use your Fulfillment Module Provider, add it to the \`providers\` array of the Fulfillment Module:
\`\`\`js title="medusa-config.js" \`\`\`js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -61,7 +61,7 @@ The Notification Module accepts one provider per channel.
</Note> </Note>
\`\`\`js title="medusa-config.js" \`\`\`js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...
@@ -60,7 +60,7 @@ This exports the module's definition, indicating that the \`MyPaymentProviderSer
To use your Payment Module Provider, add it to the \`providers\` array of the Payment Module: To use your Payment Module Provider, add it to the \`providers\` array of the Payment Module:
\`\`\`js title="medusa-config.js" \`\`\`js title="medusa-config.js"
import { Modules } from "@medusajs/utils" const { Modules } = require("@medusajs/utils")
// ... // ...