import type { Compiler as RspackCompiler } from '@rspack/core'; import type { Compiler as WebpackCompiler } from 'webpack'; import { type ModuleFederationPluginV1Config } from './ModuleFederationPluginV1.js'; /** * {@link ModuleFederationPluginV1Config} configuration options. * * The fields and types are exactly the same as in `webpack.container.ModuleFederationPlugin`. * * You can check documentation for all supported options here: https://webpack.js.org/plugins/module-federation-plugin/ */ export type ModuleFederationPluginConfig = ModuleFederationPluginV1Config; /** * Webpack plugin to configure Module Federation with platform differences * handled under the hood. * * Usually, you should use `Repack.plugin.ModuleFederationPlugin` * instead of `webpack.container.ModuleFederationPlugin`. * * `Repack.plugin.ModuleFederationPlugin` creates: * - default for `filename` option when `exposes` is defined * - default for `library` option when `exposes` is defined * - default for `shared` option with `react` and `react-native` dependencies * - converts `remotes` into `ScriptManager`-powered `promise new Promise` loaders * * You can overwrite all defaults by passing respective options. * * `remotes` will always be converted to ScriptManager`-powered `promise new Promise` loaders * using {@link Federated.createRemote}. * * @example Host example. * ```js * import * as Repack from '@callstack/repack'; * * new Repack.plugins.ModuleFederationPlugin({ * name: 'host, * }); * ``` * * @example Host example with additional `shared` dependencies. * ```js * import * as Repack from '@callstack/repack'; * * new Repack.plugins.ModuleFederationPlugin({ * name: 'host, * shared: { * react: Repack.Federated.SHARED_REACT, * 'react-native': Repack.Federated.SHARED_REACT, * 'react-native-reanimated': { * singleton: true, * }, * }, * }); * ``` * * @example Container examples. * ```js * import * as Repack from '@callstack/repack'; * * new Repack.plugins.ModuleFederationPlugin({ * name: 'app1', * remotes: { * module1: 'module1@https://example.com/module1.container.bundle', * }, * }); * * new Repack.plugins.ModuleFederationPlugin({ * name: 'app2', * remotes: { * module1: 'module1@https://example.com/module1.container.bundle', * module2: 'module1@dynamic', * }, * }); * ``` * * @category Webpack Plugin */ export declare class ModuleFederationPlugin { private config; private deepImports; private plugin; constructor(pluginConfig: ModuleFederationPluginV1Config); apply(compiler: RspackCompiler): void; apply(compiler: WebpackCompiler): void; }