Skip to content

Commit

Permalink
fix(vite): disable redundant copyPublicDir option (#8039)
Browse files Browse the repository at this point in the history
  • Loading branch information
markdalgleish authored Nov 17, 2023
1 parent e6d1176 commit f7062e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
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

0 comments on commit f7062e4

Please sign in to comment.