-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Reproduction
Go to https://stackblitz.com/edit/github-ijguxq6j and then run npm run build
// terminal output
❯ yarn build
yarn run v1.22.19
$ react-router build
(node:19) ExperimentalWarning: WASI is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
vite v6.3.5 building for production...
(node:19) ExperimentalWarning: WASI is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
✓ 43 modules transformed.
build/client/.vite/manifest.json 1.31 kB │ gzip: 0.35 kB
build/client/assets/root-DMQQlEyF.css 4.94 kB │ gzip: 1.67 kB
build/client/assets/about-CJojPYgN.js 0.15 kB │ gzip: 0.16 kB
build/client/assets/home-DcH2yVSW.js 0.39 kB │ gzip: 0.28 kB
build/client/assets/root-DOrtDzOX.js 0.80 kB │ gzip: 0.47 kB
build/client/assets/chunk-C37GKA54-BMHwpGcR.js 115.13 kB │ gzip: 38.82 kB
build/client/assets/entry.client-iUu85MFR.js 186.58 kB │ gzip: 59.09 kB
✓ built in 9.01s
vite v6.3.5 building SSR bundle for production...
✓ 8 modules transformed.
build/server/.vite/manifest.json 0.20 kB
build/server/assets/server-DMQQlEyF.css 4.94 kB
build/server/server.js 7.58 kB
✓ 1 asset cleaned from React Router server build.
build/server/assets/server-DMQQlEyF.css
The following error is a bug in React Router; please open an issue! https://github.com/remix-run/react-router/issues/new/choose
✗ Build failed in 838ms
[react-router] Server build file not found in manifest
at invariant (/home/projects/jvmikrxwbl.github/node_modules/@react-router/dev/dist/vite.js:81:11)
at getServerBuildFile (/home/projects/jvmikrxwbl.github/node_modules/@react-router/dev/dist/vite.js:2354:3)
at Object.handler (/home/projects/jvmikrxwbl.github/node_modules/@react-router/dev/dist/vite.js:3474:15) {
code: 'PLUGIN_ERROR',
plugin: 'react-router',
hook: 'writeBundle'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.// react-router.config.ts content
import type { Config } from '@react-router/dev/config';
export default {
// Config options...
// Server-side render by default, to enable SPA mode set this to `false`
ssr: true,
prerender: async () => ['/', '/about'],
} satisfies Config;// vite.config.ts content
import { reactRouter } from '@react-router/dev/vite';
import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import netlifyPlugin from '@netlify/vite-plugin-react-router';
export default defineConfig({
plugins: [tailwindcss(), reactRouter(), tsconfigPaths(), netlifyPlugin()],
});System Info
OS : Ubuntu 24.04
Browser : ChromeUsed Package Manager
npm
Expected Behavior
The build should succeed when using the @netlify/vite-plugin-react-router package in combination with defined pre-render routes in react-router.config.ts . I expect the plugin to work smoothly with Vite and React Router, enabling proper deployment to Netlify without build failures.
Actual Behavior
When I include the @netlify/vite-plugin-react-router plugin in vite.config.ts and have pre-render routes defined, the build fails and throws an error. However, the build succeeds if I either remove the plugin or remove the pre-render routes from react-router.config.ts, which defeats the purpose of pre-rendering routes for better performance.