logo
Guide
API
Blog
简体中文
English
Guide
API
Blog
简体中文
English
logo

@esmx/core

Esmx
App
RenderContext
ModuleConfig
PackConfig
ManifestJson

App

@esmx/rspack
@esmx/rspack-vue

Last Updated: 11/20/2025, 2:11:30 AM

Previous PageRenderContext
Next PagePackConfig

#ModuleConfig

The core configuration interface for the module system.

#Interface Definition

interface ModuleConfig {
    links?: Record<string, string>;
    imports?: ModuleConfigImportMapping;
    scopes?: Record<string, ModuleConfigImportMapping>;
    exports?: ModuleConfigExportExports;
}

#links

  • Type: Record<string, string>
  • Description: Module linking configuration, where the key is the remote module name and the value is the module build artifact directory path.

#imports

  • Type: ModuleConfigImportMapping
  • Description: Module import mapping configuration, where the key is the local module identifier and the value is the remote module path. Supports environment-specific configuration.

#scopes

  • Type: Record<string, ModuleConfigImportMapping>
  • Description: Module scope mapping configuration, where the key is the directory path prefix and the value is the import mapping configuration within that scope.

#exports

  • Type: ModuleConfigExportExports
  • Description: Module export configuration. Supports multiple configuration formats.

#Type Definitions

#ModuleConfigImportMapping

type ModuleConfigImportMapping = Record<
    string,
    string | Record<BuildEnvironment, string>
>;

Import mapping configuration type, supporting string and environment-specific configurations.

#ModuleConfigExportExports

type ModuleConfigExportExports = ModuleConfigExportExport[];

Export configuration array type, supporting mixed arrays of strings and export objects.

#ModuleConfigExportExport

type ModuleConfigExportExport = string | ModuleConfigExportObject;

Export configuration item type, supporting both string and export object formats.

#ModuleConfigExportObject

type ModuleConfigExportObject = Record<
    string,
    ModuleConfigExportObjectValue
>;

Export object configuration type, where the key is the export name and the value is the export configuration value.

#ModuleConfigExportObjectValue

type ModuleConfigExportObjectValue =
    | string
    | Record<BuildEnvironment, string | boolean>;

Export configuration value type, supporting string and environment-specific configurations.

#BuildEnvironment

type BuildEnvironment = 'client' | 'server';

Build target environment type.

#Parsed Interface

#ParsedModuleConfig

interface ParsedModuleConfig {
    name: string;
    root: string;
    links: Record<string, ParsedModuleConfigLink>;
    environments: {
        client: ParsedModuleConfigEnvironment;
        server: ParsedModuleConfigEnvironment;
    };
}

#ParsedModuleConfigEnvironment

interface ParsedModuleConfigEnvironment {
    imports: Record<string, string>;
    exports: ParsedModuleConfigExports;
    scopes: Record<string, Record<string, string>>;
}

#ParsedModuleConfigLink

interface ParsedModuleConfigLink {
    name: string;
    root: string;
    client: string;
    clientManifestJson: string;
    server: string;
    serverManifestJson: string;
}

#ParsedModuleConfigExports

type ParsedModuleConfigExports = Record<
    string,
    ParsedModuleConfigExport
>;

Parsed export configuration record type, where the key is the export name and the value is the export configuration object.

#ParsedModuleConfigExport

interface ParsedModuleConfigExport {
    name: string;
    file: string;
    pkg: boolean;
}