Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase Bundle Size for Module Federation 19.7.2 #27916

Open
1 of 4 tasks
sorozco653 opened this issue Sep 13, 2024 · 4 comments
Open
1 of 4 tasks

Increase Bundle Size for Module Federation 19.7.2 #27916

sorozco653 opened this issue Sep 13, 2024 · 4 comments
Assignees
Labels
blocked: third-party scope: module federation Issues related to module federation support type: bug

Comments

@sorozco653
Copy link

Current Behavior

I've noticed that after upgrading my project from v19.4.4 to the latest version of Nx v19.7.2, the bundle size has increased from 660 kB to 1.29 MB, almost doubling in size. I haven't updated any module-federation configs, so I'm curious if the v2 of the module federation enhancement is causing a significant increase. Is this increase expected? Are there any best practices I can use to reduce our bundle size?

Before:
image

After:
image

Here's an another example with simple MFE repo
image

Expected Behavior

Ideally, the bundle size should stay the relatively the same

GitHub Repo

N/A

Steps to Reproduce

  1. Create an MFE host and remote app w/nx 19.7.2
  2. create a library that uses loadRemoteModule
  3. Build the libraries and compare

Nx Report

Node           : 20.12.2
OS             : darwin-arm64
Native Target  : aarch64-macos
yarn           : 4.4.1

nx (global)        : 19.5.6
nx                 : 19.7.2
@nx/js             : 19.7.2
@nx/jest           : 19.7.2
@nx/linter         : 19.7.2
@nx/eslint         : 19.7.2
@nx/workspace      : 19.7.2
@nx/angular        : 19.7.2
@nx/devkit         : 19.7.2
@nx/eslint-plugin  : 19.7.2
@nx/playwright     : 19.7.2
@nrwl/tao          : 19.7.2
@nx/vite           : 19.7.2
@nx/web            : 19.7.2
@nx/webpack        : 19.7.2
nx-cloud           : 19.1.0
typescript         : 5.5.4
---------------------------------------
Community plugins:
@ngrx/operators : 18.0.2
@ngrx/signals   : 18.0.2
ng-mocks        : 14.13.1

Failure Logs

N/A

Package Manager Version

4.4.1

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@Coly010
Copy link
Contributor

Coly010 commented Sep 16, 2024

Hey @sorozco653!

This is expected, for now.

Module Federation 2.0 bundles the federtaion runtime into the remoteEntry files.
There is work being done currently by Zack Jackson to offer avenues to remove the federation runtime from the remoteEntry files: module-federation/core#2932

@Coly010 Coly010 self-assigned this Sep 16, 2024
@Coly010 Coly010 added blocked: third-party scope: module federation Issues related to module federation support labels Sep 16, 2024
@sorozco653
Copy link
Author

It looks like module-federation/core#2932 has been merged and release with v0.6.7

@Coly010
Copy link
Contributor

Coly010 commented Oct 1, 2024

It has, but there's a potential bug introduced with that release also.

I'll be investigating it further

@sorozco653
Copy link
Author

Any update with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: third-party scope: module federation Issues related to module federation support type: bug
Projects
None yet
Development

No branches or pull requests

2 participants