feat: Add a dev option to always read origin from config #281
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello everyone! Thank you for your great work on this project!
This PR adds a dev option named
alwaysReadOriginFromConfig: booleanto make sure the origin is never read fromwindow.originin dev mode.Why is it even needed?
When working in the "prod-like" dev environment*, the vite dev server is serving its content via localhost but the web application is accessed via a deployed proxy (think of it as an app deployed to a public domain that loads its content from localhost).
When the proposed above option is enabled, it ensures that all assets are consistently fetched from one origin rather than from two (localhost and the origin of the proxy) and the module federation will work as expected. It's hard to come up with an example in this repository but I could give it a try if it would help to illustrate the use case.
*"Prod-like" dev environment -- an environment that provides access to other services like auth, APIs, etc. in the same way as it works in prod.
Please let me know if you have any concerns or you need more details. I'm happy to add docs, test, etc. if needed. Thank you!