feat(remix-dev/vite): partial support for custom basename during dev #8141
+44
−27
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.
Closes: #8052
References: #2891, #8077 (comment), #5236
(EDIT: This PR could be superseded by #8145. I'll keep it for now as a reference, but feel free to close this if this PR is considered unnecessary.)
For basic support of this feature, I added
publicPath
prefix to all client-visible urls, which was done only for "build" case so far.Note that react-router is still not aware of the custom base, so users are still required to put prefix manually (for example,
<Link to="/mybase/some-path" />
and also for route fileroutes/mybase.some-path.tsx
), but the community might be okay with this restriction for starter.(
Actually, in this regard, I think Remix could revive what this PR did #5236. If it's preferred to get there directly, then I can try to integrate that change to here.Ah, maybe not, I don't think that PR is integrating react-router basename?)As a continuation, I'm experimenting with integrating react-router's
basename
option in #8145testing strategy
Currently I'm testing this patch in this repo https://github.com/hi-ogawa/remix-vite-custom-base.
I can also add playwright tests here if remix team decides the official way of supporting custom base.