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

Support relative base path on dev server #17482

Closed
4 tasks done
juan-rvty opened this issue Jun 14, 2024 · 6 comments
Closed
4 tasks done

Support relative base path on dev server #17482

juan-rvty opened this issue Jun 14, 2024 · 6 comments

Comments

@juan-rvty
Copy link

juan-rvty commented Jun 14, 2024

Description

Make

 const config = {
  base: './'
}

supported in the dev server.

Use case:

Our app always runs inside iframes, even during development.
This relates to:
#14105
but in my case the uri is not known before hand.
Also relates to:
#11142

Suggested solution

Allow relative base path in dev mode.

Alternative

No response

Additional context

No response

Validations

@patak-dev
Copy link
Member

Would you create a minimal reproduction of what your use case so we better understand it. Maybe it would be easier to discuss with a PR to show how the implementation looks. But as we stated in the other open issues, the complexity of supporting a relative base during development was too much to justify the feature.

@zhangHongEn
Copy link

module-federation/vite#52
This problem also occurs in the module-federation scenario. The host port is 5175, the remote port is 5176, but the remote resource uses /
image
image

@husayt
Copy link
Contributor

husayt commented Aug 12, 2024

@patak-dev @yyx990803 FYI, there has been a very good progress with Module Federation support for Vite over last month here (check the new-config branch and examples there). Here @zhangHongEn and @gioboa have used recently released Module Federation 2 which is bundler agnostic. So this hopefully will significantly help efforts to get Vite Module Federation support in place. This approach saves us from implementing MF from scratch and offers consistent behaviour across bundlers, which is especially important in case of MF as modules are often built with different bundlers and it is important to have compatible implementation across. Also, RsPack and NextJs are using this approach to get there MF implemented.

Since MF has been one of the few areas where Vite was not up to speed, it will be great to work with them in order to get first class Module federation support in Vite

@sapphi-red
Copy link
Member

@zhangHongEn In your case, won't server.origin: 'https://localhost:5176' work?

@zhangHongEn
Copy link

@zhangHongEn In your case, won't server.origin: 'https://localhost:5176' work?

server.origin solved my problem

@sapphi-red
Copy link
Member

I'm closing this issue as the author has not provided any additional details for a while and the module federation one is covered by server.origin. Feel free to create a new issue with more details if it's still something that is good to have.

@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Sep 10, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants