Skip to content

Remove react-router:override-optimize-deps plugin #13317

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/wicked-birds-suffer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@react-router/dev": patch
---

Reinstate dependency optimization in the child compiler to fix `depsOptimizer is required in dev mode` errors when using `vite-plugin-cloudflare` and importing Node.js builtins
20 changes: 0 additions & 20 deletions packages/react-router-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1445,26 +1445,6 @@ export const reactRouterVitePlugin: ReactRouterVitePlugin = () => {
configureServer: undefined,
configurePreviewServer: undefined,
})),
{
name: "react-router:override-optimize-deps",
config(userConfig) {
// Prevent unnecessary dependency optimization in the child compiler
if (
ctx.reactRouterConfig.future.unstable_viteEnvironmentApi &&
userConfig.environments
) {
for (const environmentName of Object.keys(
userConfig.environments
)) {
userConfig.environments[environmentName].optimizeDeps = {
noDiscovery: true,
};
}
} else {
userConfig.optimizeDeps = { noDiscovery: true };
}
},
},
],
});
await viteChildCompiler.pluginContainer.buildStart({});
Expand Down