Replies: 5 comments 5 replies
-
Hello, everyone. Let me know what I should include here to spark your interest. I am thinking about the possibility of changing base to: base: string | { url: string, alwaysPreserve: boolean } This way it is easy to backwards compatible while |
Beta Was this translation helpful? Give feedback.
-
I browsed the Vite code a bit more and realized my original thought wouldn't work: The base middleware uses the base and is always expected to be a relative path. Since the Actually, since only the middleware needs this, maybe there's no need to have it in the resolved configuration object. Maybe the middleware, upon initialization, can calculate the relative base from a resolved base that no longer converts external (full) URL's to relative URL's. |
Beta Was this translation helpful? Give feedback.
-
Scratch both ideas above. I opened issue #14000 with what I think would be the correct process. |
Beta Was this translation helpful? Give feedback.
-
The solution, provided by R-Ram95: Configure |
Beta Was this translation helpful? Give feedback.
-
@webJose Could you share your complete |
Beta Was this translation helpful? Give feedback.
-
Hello everyone,
I am experimenting with Vite and
single-spa
, and it seems that I have reached an impass when trying to encapsulate thesingle-spa
configuration in a Vite plug-in: The base option doesn't work as expected when runningnpm run dev
(serving). You see, the base needs to be a full URL, but the full URL is getting stripped down to just/
.Browsing the code, I see that the
resolveBaseUrl()
function in config.ts, line 899, will reduce the full URL to a relative URL if one of two conditions happen: Vite is not running in build mode, or the base URL is not an external URL, which is defined by a regular expression that detects the presence ofhttp://
orhttps://
in the value ofbase
.I suppose that, under "normal" usage,
serve
has little use for the domain part in thebase
configuration property, but it so happens that it is significant in the context ofsingle-spa
: If the full URL is not persisted, assets are not properly served when yoursingle-spa
microservice is being tested usingnpm run dev
.So I wonder if I could spark a discussion around enhancing Vite to support the
single-spa
scenario.Cheers!
Beta Was this translation helpful? Give feedback.
All reactions