zephyr-rspress-plugin
Version:
Rspress plugin for Zephyr
44 lines • 1.82 kB
text/typescript
import { type ModuleFederationPlugin } from 'zephyr-xpack-internal';
import type { ZephyrBuildTarget } from 'zephyr-agent';
type RsbuildOnBeforeCreateCompilerArgs = {
bundlerConfigs?: RspackConfig[];
};
type RspackConfig = {
name?: string;
target?: unknown;
output?: {
publicPath?: unknown;
};
plugins?: unknown[];
};
type RsbuildPluginApi = {
onBeforeCreateCompiler: (options: {
order: 'post';
handler: (args: RsbuildOnBeforeCreateCompilerArgs) => void;
}) => void;
};
type RsbuildPlugin = {
name: string;
setup: (api: RsbuildPluginApi) => void;
};
export interface ModuleFederationPublicPathPluginOptions {
/** TAP artifacts are SDK-locked and must retain their emitted public path verbatim. */
target?: ZephyrBuildTarget;
/**
* Receives Module Federation plugins from Rspress's deployable browser compilers. The
* build-time node compiler emits SSG artifacts under the same container identity, so it
* must not publish a second, conflicting metadata record for that identity.
*/
onModuleFederationPlugins?: (plugins: ModuleFederationPlugin[]) => void;
}
export declare function moduleFederationPublicPathPlugin(options?: ModuleFederationPublicPathPluginOptions): RsbuildPlugin;
/**
* Rspress SSG produces separate browser and node compilers. Native `auto` public paths
* make browser chunks resolve from their loading script without injecting a
* `getPublicPath`/`new Function` runtime. The node compiler deliberately retains its
* required absolute public path; Module Federation's Rspress integration rejects `/` and
* `auto` for that compiler.
*/
export declare function setPortableModuleFederationPublicPath(config: RspackConfig): void;
export {};
//# sourceMappingURL=moduleFederationPublicPathPlugin.d.mts.map