Skip to content

Commit

Permalink
Revert optimize deps (#10099)
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 authored Oct 11, 2024
1 parent 2ca5610 commit ee15d80
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .changeset/slow-guests-wait.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@remix-run/dev": patch
---

Revert `future.v3_optimizeDeps` back to `future.unstable_optimizeDeps` as it was not intended to stabilize in Remix v2
3 changes: 1 addition & 2 deletions docs/guides/dependency-optimization.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ title: Dependency optimization

# Dependency optimization

Remix introduced automatic dependency optimization in development behind the `future.v3_optimizeDeps` [Future Flag][future-flags].
This allows you to opt-into this behavior which will become the default in the next major version of Remix - a.k.a. React Router v7 ([1][rr-v7], [2][rr-v7-2]).
Remix introduced automatic dependency optimization in development behind the `future.unstable_optimizeDeps` [Future Flag][future-flags]. This allows you to opt-into this behavior which will eventually become the default in some future version of Remix - a.k.a. React Router ([1][rr-v7], [2][rr-v7-2]). This flag is intended to remain "unstable" into React Router v7 as there is some additional bundling-related work coming that will ease adoption of the flag. We plan to stabilize the flag once that work is completed in v7.

In development, Vite aims to [prebundle dependencies][prebundle-dependencies] so that it can efficiently serve up those dependencies on-demand.
To do this, Vite needs to know where to start crawling your app's module graph to look for dependencies.
Expand Down
20 changes: 2 additions & 18 deletions docs/start/future-flags.md
Original file line number Diff line number Diff line change
Expand Up @@ -472,25 +472,9 @@ You shouldn't need to make any changes to your application code for this feature

You may find some usage for the new [`<Link discover>`][discover-prop] API if you wish to disable eager route discovery on certain links.

## v3_optimizeDeps
## unstable_optimizeDeps

**Background**

This flag allows you to opt-into automatic [dependency optimization][dependency-optimization] during development when using Vite.

👉 **Enable the Flag**

```ts filename=vite.config.ts
remix({
future: {
v3_optimizeDeps: true,
},
});
```

**Update your Code**

You shouldn't need to make any changes to your application code for this feature to work.
Opt into automatic [dependency optimization][dependency-optimization] during development. This flag will remain in an "unstable" state until React Router v7 so you do not need to adopt this in your Remix v2 app prior to upgrading to React Router v7.

[development-strategy]: ../guides/api-development-strategy
[fetcherpersist-rfc]: https://github.com/remix-run/remix/discussions/7698
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-dev/__tests__/readConfig-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ describe("readConfig", () => {
"entryServerFile": "entry.server.tsx",
"entryServerFilePath": Any<String>,
"future": {
"unstable_optimizeDeps": false,
"v3_fetcherPersist": false,
"v3_lazyRouteDiscovery": false,
"v3_optimizeDeps": false,
"v3_relativeSplatPath": false,
"v3_singleFetch": false,
"v3_throwAbortReason": false,
Expand Down
4 changes: 2 additions & 2 deletions packages/remix-dev/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ interface FutureConfig {
v3_throwAbortReason: boolean;
v3_singleFetch: boolean;
v3_lazyRouteDiscovery: boolean;
v3_optimizeDeps: boolean;
unstable_optimizeDeps: boolean;
}

type NodeBuiltinsPolyfillOptions = Pick<
Expand Down Expand Up @@ -605,7 +605,7 @@ export async function resolveConfig(
v3_throwAbortReason: appConfig.future?.v3_throwAbortReason === true,
v3_singleFetch: appConfig.future?.v3_singleFetch === true,
v3_lazyRouteDiscovery: appConfig.future?.v3_lazyRouteDiscovery === true,
v3_optimizeDeps: appConfig.future?.v3_optimizeDeps === true,
unstable_optimizeDeps: appConfig.future?.unstable_optimizeDeps === true,
};

if (appConfig.future) {
Expand Down
2 changes: 1 addition & 1 deletion packages/remix-dev/vite/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ export const remixVitePlugin: RemixVitePlugin = (remixUserConfig = {}) => {
: undefined,
},
optimizeDeps: {
entries: ctx.remixConfig.future.v3_optimizeDeps
entries: ctx.remixConfig.future.unstable_optimizeDeps
? [
ctx.entryClientFilePath,
...Object.values(ctx.remixConfig.routes).map((route) =>
Expand Down

0 comments on commit ee15d80

Please sign in to comment.