-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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 custom Vite build.assetsDir
option
#8843
Conversation
Previously the manifest location was set to the hardcoded path of `assets`, but if a user configures their build to change the `assetsDir` from Vite the result was a file that was still left in the assets folder. To handle the configuration in Vite, this moves the path generation to utilize Vite's value so that the manifest javascript file is colocated with all other client assets. Signed-off-by: Eric Chernuka <ericchernuka@gmail.com>
🦋 Changeset detectedLatest commit: 6b125cb 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 |
Hi @ericchernuka, Welcome, and thank you for contributing to Remix! Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once. You may review the CLA and sign it by adding your name to contributors.yml. Once the CLA is signed, the If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at hello@remix.run. Thanks! - The Remix team |
Signed-off-by: Eric Chernuka <ericchernuka@gmail.com>
Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳 |
build.assetsDir
option
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.
Thanks for the PR!
🤖 Hello there, We just published version Thanks! |
🤖 Hello there, We just published version Thanks! |
I was in need of having the assets directory in a different location due to a proxy. Leveraging Vite's
build#assetsDir
, I was able to achieve most of what I needed, but there was a straggler file atbuild/client/assets/manifest-{hash}.js
even though the configuration of the asset was set to a different directory. To ensure this file adheres to the Vite configuration, I've added handling to build the path from the Vite configuration.Testing Strategy:
I wasn't able to find any test regarding the Vite plugin functionality so I ended up utilizing manual testing using the playground. To recreate this, I leveraged the
template.local
feature of thescripts/playground
directory.npx create-remix@latest ./scripts/playground/template.local --template remix-run/remix/templates/vite-cloudflare
@remix/*
to all reference*
to match existing base templateyarn build
to build fresh version with the changes in this PRyarn playground:new
to create a fresh templateyarn build
client
andserver
directories. Theclient
directory should be a subdirectory namedassets,
which includes amanifest-{hash}.js.
yarn build
. The result should be a build directory with two directories,client
andserver
. Within theclient
directory, there should no longer be anassets
directory containingmanifest-{hash}.js
, and it should now be part of theassets-remix
directory.