Skip to content
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

Revert optimize deps #10099

Merged
merged 3 commits into from
Oct 11, 2024
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/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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


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
Loading