import { defineConfig } from '@rsbuild/core'; import { pluginReact } from '@rsbuild/plugin-react'; import { ModuleFederationPlugin } from '@module-federation/enhanced/rspack'; export default defineConfig({ server: { port: 3005, }, dev: { // It is necessary to configure assetPrefix, and in the production environment, you need to configure output.assetPrefix assetPrefix: 'http://localhost:3005', }, tools: { rspack: (config, { appendPlugins }) => { // You need to set a unique value that is not equal to other applications config.output!.uniqueName = 'apna_module_test'; appendPlugins([ new ModuleFederationPlugin({ name: 'apna_module_test', exposes: { './Button': './src/Button.tsx', './EditProfileButton': './src/EditProfileButton.tsx', }, shared: ['react', 'react-dom'], getPublicPath: `function() {return "https://cdn.jsdelivr.net/npm/@nandubatchu/apna-module-test/dist/"}`, }), ]); }, }, plugins: [pluginReact()], });