core icon indicating copy to clipboard operation
core copied to clipboard

RemoteEntry file size increased by ~7x

Open sudhakar-selva opened this issue 8 months ago • 13 comments

Describe the bug

Noticed a substantial increase in remote-entry file size during our migration from v1 to v2 and observed this for our webpack-based application as well as the rsbuild one. It appears that most of the additional size is coming from the module federation SDK and runtime. Is this expected? How can we reduce the remote entry file size?

// rsbuild.config.ts
export default defineConfig({
  plugins: [
      pluginReact({
          swcReactOptions: {
              development: isDev,
              refresh: isDev,
          },
       }), 
      pluginStyledComponents(), 
      pluginBasicSsl()
  ],
  tools: {
    rspack(config, { addRules, appendPlugins }) {
      config.output!.uniqueName = 'unique_name'
      appendPlugins([
        new ModuleFederationPlugin({
          name: 'App',
          filename: 'remoteEntry.js',
          exposes: {
            //...
          },
          remotes: {
            // ...
          },
         /** Returns all dependencies from pkg.json and sets singleton for react*, react-router* and  couple other pkgs**/
          shared: getSharedDependencies(),
          manifest: false,
          dts: false,
        })
      ])

      return config;
    },
  }
});
Screenshot 2024-06-04 at 11 35 06 PM

Reproduction

Added build config in description - please let me know if further details required

Used Package Manager

yarn

System Info

System:
    OS: macOS 13.6.6
    CPU: (8) arm64 Apple M1 Pro
    Memory: 85.33 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.12.1 - ~/.nvm/versions/node/v18.12.1/bin/node
    Yarn: 1.22.19 - ~/node_modules/.bin/yarn
    npm: 8.19.2 - ~/.nvm/versions/node/v18.12.1/bin/npm
    Watchman: 2023.11.06.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 125.0.6422.114
    Firefox: 117.0
    Safari: 17.5

Validations

sudhakar-selva avatar Jun 04 '24 18:06 sudhakar-selva