-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
fix(remix-dev/vite): change build output paths #8077
Conversation
🦋 Changeset detectedLatest commit: 98a2d86 The changes in this PR will be included in the next version bump. This PR includes changesets to release 16 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Would this necessitate updating image sec references in the apps as well? For example, given you had an image stored at Would the recommended approach change to storing image assets in a
|
@justinwaite Without this PR, you'd have to move your images from |
let defaults: Partial<RemixVitePluginOptions> = { | ||
serverBuildPath: "build/server/index.js", | ||
assetsBuildDirectory: "build/client", | ||
publicPath: "/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change!
With this change of default publicPath
from /build
to /
, I feel it became closer to what base
vite config does (base
default value is also /
https://vitejs.dev/config/shared-options.html#base).
I think remix still doesn't support custom basename in general, but I was wondering if it makes sense to deprecate publicPath
remix config and favor base
option from user vite config at some point (which also somehow works on dev too hopefully).
For the reference:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a really good point! I'll keep this in mind when looking at custom base
support.
This is available in the latest nightly, currently @justinwaite @gustavopch @nicksrandall If you could all try it out and report back, that would be super helpful 🙏 |
@markdalgleish I have migrated and it is working. I like this approach. |
@markdalgleish I was able to fork my original stackblitz and migrate: https://stackblitz.com/edit/remix-run-remix-5qicaa?file=vite.config.ts The setup in the stackblitz is to emulate how we would setup an app to run on a base path with how Remix works today. In this case, the basepath is
Testing it out, the build directory does indeed get populated with Just a couple of thoughts:
Thanks for the quick support on this one! |
@markdalgleish Working here as well! |
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
This is a fix for #8039 (comment) and a better fix for #8023 and #8038.
See the changeset and updated docs for more details, but tl;dr:
build/server
by default (rather thanbuild
)build/client
by default (rather thanpublic/build
)This fixes an issue where the way Vite manages the
public
directory clashes with the way the existing Remix compiler works. So far we've been trying to get Vite to behave like the Remix compiler but it's causing issues since it's such a different model, so instead we're now leaning into the way Vite works.As a bonus, I personally think the build output feels a lot cleaner too ✨