Vite dependency optimization is causing errors in development
Reproduction
See #8876 and #8917.
// vite.config.ts
import {
vitePlugin as remix,
cloudflareDevProxyVitePlugin as remixCloudflareDevProxy,
} from "@remix-run/dev";
import { defineConfig } from "vite";
import tsconfigPaths from "vite-tsconfig-paths";
import { getLoadContext } from "./loadContext";
export default defineConfig({
plugins: [
remixCloudflareDevProxy({ getLoadContext }),
remix(),
tsconfigPaths(),
],
});
System Info
System:
OS: macOS 14.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 1.79 GB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
Browsers:
Chrome: 126.0.6478.183
Chrome Canary: 129.0.6622.0
Safari: 17.1
npmPackages:
@remix-run/cloudflare: ^2.10.3 => 2.10.3
@remix-run/cloudflare-pages: ^2.10.3 => 2.10.3
@remix-run/dev: ^2.10.3 => 2.10.3
@remix-run/eslint-config: ^2.10.3 => 2.10.3
@remix-run/react: ^2.10.3 => 2.10.3
vite: ^5.3.5 => 5.3.5
Used Package Manager
npm
Expected Behavior
Pages load smoothly.
Actual Behavior
Errors like the following on page loads:
Yep, all pages visited for the first time fail to load because Vite optimizes the dependencies, but sends a 504 Outdated Dependency to the browser.
Only happens in during dev and doesn't affect production, but having all tests (or page loads) fail on first try is a bad experience.
Thank you for opening this issue, and our apologies we haven't gotten around to it yet!
With the release of React Router v7 we are sun-setting continued development/maintenance on Remix v2. If you have not already upgraded to React Router v7, we recommend you do so. We've tried to make the upgrade process as smooth as possible with our Future Flags. We are now in the process of cleaning up outdated issues and pull requests to improve the overall hygiene of our repositories.
We plan to continue to address 2 types of issues in Remix v2:
- Bugs that pose security concerns
- Bugs that prevent upgrading to React Router v7
If you believe this issue meets one of those criteria, please respond or create a new issue.
For all other issues, ongoing maintenance will be happening in React Router v7, so:
- If this is a bug, please reopen this issue in that repo with a new minimal reproduction against v7
- If this is a feature request, please open a new Proposal Discussion in React Router, and if it gets enough community support it can be considered for implementation
If you have any questions you can always reach out on Discord. Thanks again for providing feedback and helping us make our framework even better!