Skip to content

Vite V6 - [Environment API] build.assetsDir is not fully respected in the client environment #13430

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

Closed
CaptinKraken opened this issue Apr 18, 2025 · 4 comments · Fixed by #13491

Comments

@CaptinKraken
Copy link

I'm using React Router as a...

framework

Reproduction

https://stackblitz.com/edit/github-fnjseyom?file=vite.config.ts

Run npm run build and look at the output

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 20.19.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @react-router/dev: * => 7.5.1 
    @react-router/node: * => 7.5.1 
    @react-router/serve: * => 7.5.1 
    react-router: * => 7.5.1 
    vite: ^6.0.11 => 6.3.2

Used Package Manager

npm

Expected Behavior

I expect the assetsDir to be respected, for all client output files.

Image

Instead, this is only achieved by also specifying the environment.client.build.assetsDir and having it match the build.assetsDir

Actual Behavior

Image
@CaptinKraken
Copy link
Author

CaptinKraken commented Apr 18, 2025

The Vite docs highlight that the top level build config should be inherited, if an environment specific config isn't specified https://vite.dev/guide/api-environment#:~:text=when%20not%20explicitly%20documented%2C%20environment%20inherits%20the%20configured%20top-level%20config

@markdalgleish
Copy link
Member

Thanks for raising this issue.

I've merged a fix in #13491 which will be out in the next release.

Copy link
Contributor

github-actions bot commented May 8, 2025

🤖 Hello there,

We just published version 7.6.0 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Copy link
Contributor

🤖 Hello there,

We just published version 7.6.1 which involves this issue. If you'd like to take it for a test run please try it out and let us know what you think!

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants