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

How can I set publicPath to auto #251

Open
Xeikim opened this issue Feb 8, 2025 · 3 comments
Open

How can I set publicPath to auto #251

Xeikim opened this issue Feb 8, 2025 · 3 comments
Labels
COMMUNITY: PR is welcomed We think it's a good feature to have but would love for the community to help with the PR for it good first issue Good for newcomers

Comments

@Xeikim
Copy link

Xeikim commented Feb 8, 2025

The generation rule for publicPath in pluginMFManifest is to set it to auto only when base is empty

publicPath = base ? base.replace(/\/?$/, '/') : 'auto';

But the default value of vite's base option is '/', and when I set base to empty, vite overrides it to the default value '/'

There seems to be no way to set the value of publicPath to 'auto'

@gioboa
Copy link
Collaborator

gioboa commented Feb 8, 2025

Thanks @Xeikim for your report.
Would you like to drop a PR to fix it?
We can try to figure out if there is a way of retrieve the original base information before the default overwrite

@gioboa gioboa added good first issue Good for newcomers COMMUNITY: PR is welcomed We think it's a good feature to have but would love for the community to help with the PR for it labels Feb 8, 2025
@Etroid
Copy link

Etroid commented Feb 12, 2025

Would it make sense to expose publicPath as an option in the federation plugin?

@Xeikim
Copy link
Author

Xeikim commented Feb 12, 2025

I am not sure if I need to set publicPath to auto. In my project, my remote is based on vite and my host is based on webpack. In the development environment, when I load the remote module through manifest.json in the host, the publicPath of the requested entry file is set to the address of the host. So I tried to use the publicPath auto feature of webpack to make it load correctly.
Do you have any better suggestions? Thank you very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
COMMUNITY: PR is welcomed We think it's a good feature to have but would love for the community to help with the PR for it good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants