Description
I'm using React Router as a...
framework
Reproduction
I ran into an issue when upgrading from remix v2 to react-router v7. At work, for some reason our github pages enterprise integration does not render assets/_index.js
files (not sure where or why that happens). In any case, I was able to "fix" this issue in remix v2 by updating my vite.config.ts
file with some build.rollupOptions.output
options:
build: {
rollupOptions: {
// https://vitejs.dev/config/build-options.html#build-rollupoptions
output: {
// https://rollupjs.org/configuration-options/#output-assetfilenames
assetFileNames: 'myapp-assets/myapp-[name]-[hash][extname]',
// https://rollupjs.org/configuration-options/#output-chunkfilenames
chunkFileNames: 'myapp-chunks/myapp-[name]-[hash].js',
// https://rollupjs.org/configuration-options/#output-entryfilenames
entryFileNames: 'myapp-entries/myapp-[name]-[hash].js',
},
},
},
When upgrading to react-router v7, the github pages issue popped back up because assets/_index.js
files were being written again. I came up with a workaround, but I'd still like to log this bug/issue in the hopes that entryFileNames
will be respected in react-router v7 (and we can configure the "assets" folder location/name).
I've created a repo with default remix v2 and react-router v7 apps. I then converted them to spa mode and included the same build.rollupOptions.output
options.
Notice the differences in the build output:
System Info
System:
OS: macOS 15.3.1
CPU: (10) arm64 Apple M1 Max
Memory: 669.39 MB / 64.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 23.7.0 - /opt/homebrew/bin/node
npm: 10.9.2 - /opt/homebrew/bin/npm
pnpm: 10.4.1 - /opt/homebrew/bin/pnpm
Browsers:
Chrome: 133.0.6943.127
Chrome Canary: 135.0.7029.0
Safari: 18.3
Used Package Manager
pnpm
Expected Behavior
When configuring:
build.rollupOptions.output.assetFileNames
build.rollupOptions.output.chunkFileNames
build.rollupOptions.output.entryFileNames
I'd like to see almost no files in the "build/client/assets" folder. I guess manifest.js
is okay, but my "route" files should be somewhere else (and follow the naming convention I configured in rollup.
Actual Behavior
In react-router v7, the behavior is different than remix v2. I see a bunch of files in my build/client/assets
folder (manifest, route files, entry files, root files).