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

fix(manifest): public path #262

Merged

Conversation

underfin
Copy link
Contributor

The pr fixed some issues.

  • The mainifest should generate publicPath as key
  • getPublicPath is not working at dev

Copy link
Collaborator

@gioboa gioboa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @underfin it looks great to me!

@gioboa gioboa linked an issue Feb 27, 2025 that may be closed by this pull request
@gioboa gioboa merged commit 70e031b into module-federation:main Feb 27, 2025
4 checks passed
@DanilAgafonov
Copy link
Contributor

@gioboa I think PR broke getPublicPath functionality. Now if you set getPublicPath in vite config, it will end up in publicPath field in manifest file.

Like that:

{
  "id": "@app/remote",
  "name": "@app/remote",
  "metaData": {
    "name": "@app/remote",
    "type": "app",
    "buildInfo": { "buildVersion": "1.0.0", "buildName": "@app/remote" },
    "remoteEntry": {
      "name": "remoteEntry-BsIUFaZS.js",
      "path": "",
      "type": "module"
    },
    "ssrRemoteEntry": {
      "name": "remoteEntry-BsIUFaZS.js",
      "path": "",
      "type": "module"
    },
    "types": { "path": "", "name": "" },
    "globalName": "@app/remote",
    "pluginVersion": "0.2.5",
    "publicPath": "function() {return \"/\" }"
  },
  // ... more
}

It makes all consumers to use function() {return "\" } as a literal public path and they end up loading .js files from URLs like that: http://localhost:55186/function()%20%7Breturn%20%22/%22%20%7Dmodule1-CyXhgF5G.js

Please revert this change ASAP.

@gioboa
Copy link
Collaborator

gioboa commented Feb 27, 2025

Yes, I can revert it. You can use 1.2.2 in the meantime

@gioboa
Copy link
Collaborator

gioboa commented Feb 27, 2025

@DanilAgafonov would you like to drop a PR to fix this please?

DanilAgafonov added a commit to DanilAgafonov/module-federation-vite that referenced this pull request Feb 27, 2025
DanilAgafonov added a commit to DanilAgafonov/module-federation-vite that referenced this pull request Feb 27, 2025
@DanilAgafonov
Copy link
Contributor

@gioboa Yes, but I only can prepare a revert PR.

Here it is: #265

A proper fix for original issue probably should be discussed separately, but so far I don't think there is anything to fix for dev env. Current version already prints warnings in dev saying:

We are ignoring the getPublicPath options because they are natively supported by Vite with the "experimental.renderBuiltUrl" configuration https://vitejs.dev/guide/build#advanced-base-options

So I think people who want to get getPublicPath working in dev should use experimental.renderBuiltUrl.

gioboa pushed a commit that referenced this pull request Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support GetPublicPath from federation options
3 participants