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

Custom remote entry file name not getting set in mf-manifest.json #226

Open
DeveshSapkale opened this issue Dec 20, 2024 · 8 comments
Open

Comments

@DeveshSapkale
Copy link

DeveshSapkale commented Dec 20, 2024

@gioboa
Issue:
When I use below configuration in federation plugin using vite remote from the example given in this repo
{
...
manifest: true
fileName: test.remoteEntry.js
....
}

The mf-manifest.json gets generated after vite build, but in
Manifest.json
{
.....
"remoteEntry ": {
"path": "",
"type: "module"
}
...
}

File name details in this manifest are empty for remoteEntry object.

This detail is only available when I keep name as remoteEntry.js

I debugged few line of code in the plugin repo and found that in file named "src/plugins/pluginMFManifest.ts"
Under generate bundle() function there is logic which sets "remoteEntryFile" variable which is then used to set the file name in mf-manifest.json file.

In this code we check if mfOptions.filename == fileData.name which is never true because mfOptions.filename will be a full name of "test.remoteEntry.js" with .js ext.
But fileData.name will be without js ext which is just "test.remoteEntry"

So from fix point of view I think condition should use fileData.preliminaryName instead of fileData.name.

But I am not aware of the usages and reason behind that code.

Are we aware of this issue or is there a specific way I need to provide the filename in federation plugin configuration.

I need to use custom name for it, that's a requirement.

@DeveshSapkale DeveshSapkale changed the title Custom entry file name not getting set in manifest.json Custom entry file name not getting set in mf-manifest.json Dec 20, 2024
@DeveshSapkale DeveshSapkale changed the title Custom entry file name not getting set in mf-manifest.json Custom remote entry file name not getting set in mf-manifest.json Dec 20, 2024
@gioboa
Copy link
Collaborator

gioboa commented Dec 20, 2024

Hi @DeveshSapkale thanks for your feedback and investigation.
May I ask you to tackle this issue? Thanks

@DeveshSapkale
Copy link
Author

@gioboa Do you mean I should create a PR for this fix. Or should handle it at my end which means simply using "remoteEntry.js" name?
Thanks for the quick resonse

@gioboa
Copy link
Collaborator

gioboa commented Dec 20, 2024

I really would like to give you the possibility to cover your needs. Is it possible with we pack/rspack? Because in the end we are using the core library under the hood

@DeveshSapkale
Copy link
Author

Having custom name for remoteEntry file is possible with rspack's module federation plugin, it creates mf-manifest.json file properly, with given custom remote entry filename.
I agree that under the hood core library is getting used, but creation of mf-manifest.json file is part of this repo.

@gioboa
Copy link
Collaborator

gioboa commented Dec 20, 2024

Ok so let's try to implement it
Would you like to tackle it?

@zhangHongEn
Copy link
Contributor

try test-remoteEntry.js

@DeveshSapkale
Copy link
Author

@gioboa @zhangHongEn I agree that "test-remoteEntry.js" might work but I am using "test.remoteEntry.js" for my application as a convention "{remote name}.remoteEntry.js".
Sorry for the late reply I will try to create a PR soon please review it , as I am not fully aware of of this code base.

@gioboa
Copy link
Collaborator

gioboa commented Dec 26, 2024

I think the double dot can mess up things, that's my guess

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

No branches or pull requests

3 participants