module-federation / core

Module Federation is a concept that allows developers to share code and resources across multiple JavaScript applications
https://module-federation.io/
MIT License
1.52k stars 235 forks source link

[nextjs-mf] Manifest is not being generated for the client #2294

Closed ryok90 closed 6 months ago

ryok90 commented 7 months ago

Describe the bug

The mf-manifest.json is not being generated for the client side (on static/chunks) even when setting the publicPath.

image

After investigating for a little bit I saw that publicPath is manually being set to auto. Next.js puts publicPath as /_next/ as default so I propose a change when it's set differently than that, to skip the auto attribution.

Reproduction

https://github.com/ryok90/nextjs-mf-examples/tree/main/shared-mui-next14.1.3-mf8.3.3/apps/remote

Used Package Manager

npm

System Info

System:
    OS: macOS 14.4
    CPU: (10) arm64 Apple M2 Pro
    Memory: 261.00 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    Yarn: 1.22.21 - ~/.nvm/versions/node/v20.10.0/bin/yarn
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 8.15.1 - ~/.nvm/versions/node/v20.10.0/bin/pnpm
  Browsers:
    Chrome: 123.0.6312.107
    Safari: 17.4

Validations

zhoushaw commented 7 months ago

@ryok90 Can you set public path to absolute path? Currently, manifest does not support relative paths

ryok90 commented 7 months ago

@ryok90 Can you set public path to absolute path? Currently, manifest does not support relative paths

Do you mean the filePath or the publicPath?

Because the problem here is that the publicPath is being overridden to 'auto' by NextFederationPlugin.

zhoushaw commented 7 months ago

@ScriptedAlchemy It seems that this optimization is necessary

ryok90 commented 6 months ago

Closing this one but the server-side manifest still needs some work. @ScriptedAlchemy Should we open another issue to fix the server-side?