Skip to content
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(vite): disable redundant copyPublicDir option #8039

Merged
merged 2 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/proud-otters-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": patch
---

Fix redundant copying of assets from `public` directory in Vite build. This ensures that static assets aren't duplicated in the server build directory. This also fixes an issue where the build would break if `assetsBuildDirectory` was deeply nested within the `public` directory.
7 changes: 7 additions & 0 deletions packages/remix-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,13 @@ export const remixVitePlugin: RemixVitePlugin = (options = {}) => {
base: pluginConfig.publicPath,
build: {
...viteUserConfig.build,
// By convention Remix builds into a subdirectory within the
// public directory ("public/build" by default) so we don't want
// to copy the contents of the public directory around. This also
// ensures that we don't get caught in an infinite loop when
// `assetsBuildDirectory` is nested multiple levels deep within
// the public directory, e.g. "public/custom-base-dir/build"
copyPublicDir: false,
...(!isSsrBuild
? {
manifest: true,
Expand Down