import ParameterTypes from "@site/src/components/ParameterTypes"

# ModuleLoaderFunction

 **ModuleLoaderFunction**: (`options`: [LoaderOptions](types.ModulesSdkTypes.LoaderOptions.mdx), `moduleDeclaration?`: [InternalModuleDeclaration](types.ModulesSdkTypes.InternalModuleDeclaration.mdx)) => Promise&#60;void&#62;

## Type declaration

### Parameters

<ParameterTypes parameters={[
  {
    "name": "options",
    "type": "[LoaderOptions](types.ModulesSdkTypes.LoaderOptions.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "container",
        "type": "[MedusaContainer](../../CommonTypes/types/types.CommonTypes.MedusaContainer.mdx)",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "createScope",
            "type": "() => [MedusaContainer](../../CommonTypes/types/types.CommonTypes.MedusaContainer.mdx)",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "registerAdd",
            "type": "`<T>`(`name`: `string`, `registration`: `T`) => [MedusaContainer](../../CommonTypes/types/types.CommonTypes.MedusaContainer.mdx)",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "logger",
        "type": "[Logger](../../LoggerTypes/interfaces/types.LoggerTypes.Logger.mdx)",
        "description": "",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "activity",
            "type": "(`message`: `string`, `config?`: `any`) => `void`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "debug",
            "type": "(`message`: `any`) => `void`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "error",
            "type": "(`messageOrError`: `any`, `error?`: `any`) => `void`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "failure",
            "type": "(`activityId`: `any`, `message`: `any`) => `void`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "info",
            "type": "(`message`: `any`) => `void`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "log",
            "type": "(...`args`: `any`[]) => `void`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "panic",
            "type": "(`data`: `any`) => `void`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "progress",
            "type": "(`activityId`: `any`, `message`: `any`) => `void`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "setLogLevel",
            "type": "(`level`: `string`) => `void`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "shouldLog",
            "type": "(`level`: `string`) => `void`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "success",
            "type": "(`activityId`: `any`, `message`: `any`) => `void`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "unsetLogLevel",
            "type": "() => `void`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "warn",
            "type": "(`message`: `any`) => `void`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "options",
        "type": "`TOptions`",
        "description": "",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "moduleDeclaration",
    "type": "[InternalModuleDeclaration](types.ModulesSdkTypes.InternalModuleDeclaration.mdx)",
    "description": "",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "alias",
        "type": "`string`",
        "description": "If multiple modules are registered with the same key, the alias can be used to differentiate them",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "definition",
        "type": "[ModuleDefinition](types.ModulesSdkTypes.ModuleDefinition.mdx)",
        "description": "",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "canOverride",
            "type": "`boolean`",
            "description": "",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "defaultModuleDeclaration",
            "type": "[InternalModuleDeclaration](types.ModulesSdkTypes.InternalModuleDeclaration.mdx) \\| [ExternalModuleDeclaration](types.ModulesSdkTypes.ExternalModuleDeclaration.mdx)",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "defaultPackage",
            "type": "`string` \\| `false`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "dependencies",
            "type": "`string`[]",
            "description": "",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "isLegacy",
            "type": "`boolean`",
            "description": "",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "isQueryable",
            "type": "`boolean`",
            "description": "",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "isRequired",
            "type": "`boolean`",
            "description": "",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "key",
            "type": "`string`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "label",
            "type": "`string`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "registrationName",
            "type": "`string`",
            "description": "",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "dependencies",
        "type": "`string`[]",
        "description": "",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "main",
        "type": "`boolean`",
        "description": "If the module is the main module for the key when multiple ones are registered",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "options",
        "type": "`Record<string, unknown>`",
        "description": "",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "resolve",
        "type": "`string`",
        "description": "",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "resources",
        "type": "[MODULE_RESOURCE_TYPE](../enums/types.ModulesSdkTypes.MODULE_RESOURCE_TYPE.mdx)",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "ISOLATED",
            "type": "`\"isolated\"`",
            "description": "",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "SHARED",
            "type": "`\"shared\"`",
            "description": "",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "scope",
        "type": "[INTERNAL](../enums/types.ModulesSdkTypes.MODULE_SCOPE.mdx#internal)",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />

### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise",
    "type": "Promise&#60;void&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />
