core
core copied to clipboard
RemoteEntry file size increased by ~7x
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;
},
}
});
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
- [X] Read the docs.
- [X] Read the common issues list.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Module federation issue and not a framework-specific issue.
- [X] The provided reproduction is a minimal reproducible example of the bug.