Skip to content

Commit

Permalink
chore: export rsbuild plugin name & rspack plugin name
Browse files Browse the repository at this point in the history
  • Loading branch information
2heal1 committed Nov 14, 2024
1 parent d34637b commit 49c01a0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions packages/rsbuild-plugin/src/cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,19 @@ import logger from '../logger';
type ModuleFederationOptions =
moduleFederationPlugin.ModuleFederationPluginOptions;

const PLUGIN_MODULE_FEDERATION_NAME = 'rsbuild:module-federation-enhanced';
const RSBUILD_PLUGIN_MODULE_FEDERATION_NAME =
'rsbuild:module-federation-enhanced';
const RSPACK_PLUGIN_MODULE_FEDERATION_NAME = 'module-federation';

export { PLUGIN_MODULE_FEDERATION_NAME };
export {
RSBUILD_PLUGIN_MODULE_FEDERATION_NAME,
RSPACK_PLUGIN_MODULE_FEDERATION_NAME,
};

export const pluginModuleFederation = (
moduleFederationOptions: ModuleFederationOptions,
): RsbuildPlugin => ({
name: PLUGIN_MODULE_FEDERATION_NAME,
name: RSBUILD_PLUGIN_MODULE_FEDERATION_NAME,
setup: (api) => {
const sharedOptions: [string, sharePlugin.SharedConfig][] = parseOptions(
moduleFederationOptions.shared || [],
Expand Down Expand Up @@ -156,7 +161,7 @@ export const pluginModuleFederation = (

api.modifyBundlerChain(async (chain) => {
chain
.plugin('module-federation')
.plugin(RSPACK_PLUGIN_MODULE_FEDERATION_NAME)
.use(ModuleFederationPlugin, [moduleFederationOptions]);

// `uniqueName` is required for react refresh to work
Expand Down

0 comments on commit 49c01a0

Please sign in to comment.