-
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
Vite build fails, recursively creates public build directories when using assetsBuildDirectory #8023
Comments
It would be nice to support the vite |
Thanks for the reproduction! export default defineConfig((env) => ({
publicDir: env.command === 'build' ? false : undefined,
plugins: [
remix({
assetsBuildDirectory: 'public/mybase/build',
publicPath: '/mybase/build',
}),
tsconfigPaths(),
],
})); This workaround might require extra script to copy some assets afterwards, but for the setup of your repro,
Regarding this, I think this might have fundamentally different technical challenge since this will not be only about vite's Also FYI, remix plugin currently sets remix config's remix/packages/remix-dev/vite/plugin.ts Line 513 in bfa2bbc
So by default (which is
I was wondering if there is a way to achieve something similar without relying on EDIT: I forgot about current remix's
So, the usage of |
Anyone else getting this warning?
That's on the default settings. |
I did see these warnings intermittently throughout this process. I didn't nail down what it was though. |
Yeah same, I tried to finagle with the output settings but they felt quite unpredictable, because Remix is doing stuff under the hood and I'm not sure what, which @hi-ogawa just expanded on 👍 |
I'm seeing the same issue after migrating to Remix 2.3.0 and Vite v5. The ssr build is putting files in one directory too deep. UPDATE: Actually, I'm re-reading this issue and realize my issue isn't with public dir but the build dir. |
It seems like the way Remix has worked up to this point clashes with the way Vite typically works in terms of the For now at least I think we'd want to maintain the same directory structure as the existing Remix compiler to make migration as painless as possible. To do this, we'll probably need to disable Vite's build.copyPublicDir option internally. |
@nicksrandall Are you saying that you're running into a different problem? If so, could you open a separate issue? |
@markdalgleish Sorry, the issue I'm facing is very similar and my guess is that a fix for one issue might fix the other. Anyway, here is the issue I created: #8038 |
I've opened a PR to fix this, but to confirm whether this works for you in the short term, try setting export default defineConfig({
build: {
copyPublicDir: false
},
// etc.
}); |
Nice! I wasn't aware of |
I tried it briefly and it appears that it's working as intended. I didn't test too deeply or deploy anything yet, but at the very least the build passes and there are no recursive directories being created at build time. |
Fixed by #8039. |
🤖 Hello there, We just published version Thanks! |
Setting So, rather than fighting Vite's handling of the |
🤖 Hello there, We just published version Thanks! |
The fix for this issue has been superseded by this PR: #8077 The updated fix also addresses the issue @hilja raised above: #8023 (comment) |
Reproduction
https://stackblitz.com/edit/remix-run-remix-fa3huu?file=package.json
System Info
Used Package Manager
npm
Expected Behavior
When running
npm run build
in an app setup with vite that hasassetsBuildDirectory
set topublic/mybase/build
, it is expected that the build would succeed and produce the public build artifacts atpublic/mybase/build
.Actual Behavior
If the
public
folder does not exist at all, then the build passes and createspublic/mybase/build
.However, if the
public
directory exists, it tries to recursively create directories:Eventually, the build fails with the error:
The text was updated successfully, but these errors were encountered: