|
1 | 1 | # `@react-router/dev`
|
2 | 2 |
|
| 3 | +## 7.6.0-pre.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- Added a new `react-router.config.ts` `routeDiscovery` option to configure Lazy Route Discovery behavior. ([#13451](https://github.com/remix-run/react-router/pull/13451)) |
| 8 | + |
| 9 | + - By default, Lazy Route Discovery is enabled and makes manifest requests to the `/__manifest` path: |
| 10 | + - `routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }` |
| 11 | + - You can modify the manifest path used: |
| 12 | + - `routeDiscovery: { mode: "lazy", manifestPath: "/custom-manifest" }` |
| 13 | + - Or you can disable this feature entirely and include all routes in the manifest on initial document load: |
| 14 | + - `routeDiscovery: { mode: "initial" }` |
| 15 | + |
| 16 | +- Automatic types for future flags ([#13506](https://github.com/remix-run/react-router/pull/13506)) |
| 17 | + |
| 18 | + Some future flags alter the way types should work in React Router. |
| 19 | + Previously, you had to remember to manually opt-in to the new types. |
| 20 | + |
| 21 | + For example, for `unstable_middleware`: |
| 22 | + |
| 23 | + ```ts |
| 24 | + // react-router.config.ts |
| 25 | + |
| 26 | + // Step 1: Enable middleware |
| 27 | + export default { |
| 28 | + future: { |
| 29 | + unstable_middleware: true, |
| 30 | + }, |
| 31 | + }; |
| 32 | + |
| 33 | + // Step 2: Enable middleware types |
| 34 | + declare module "react-router" { |
| 35 | + interface Future { |
| 36 | + unstable_middleware: true; // 👈 Enable middleware types |
| 37 | + } |
| 38 | + } |
| 39 | + ``` |
| 40 | + |
| 41 | + It was up to you to keep the runtime future flags synced with the types for those future flags. |
| 42 | + This was confusing and error-prone. |
| 43 | + |
| 44 | + Now, React Router will automatically enable types for future flags. |
| 45 | + That means you only need to specify the runtime future flag: |
| 46 | + |
| 47 | + ```ts |
| 48 | + // react-router.config.ts |
| 49 | + |
| 50 | + // Step 1: Enable middleware |
| 51 | + export default { |
| 52 | + future: { |
| 53 | + unstable_middleware: true, |
| 54 | + }, |
| 55 | + }; |
| 56 | + |
| 57 | + // No step 2! That's it! |
| 58 | + ``` |
| 59 | + |
| 60 | + Behind the scenes, React Router will generate the corresponding `declare module` into `.react-router/types`. |
| 61 | + Currently this is done in `.react-router/types/+register.ts` but this is an implementation detail that may change in the future. |
| 62 | + |
| 63 | +### Patch Changes |
| 64 | + |
| 65 | +- Support project root directories without a `package.json` if it exists in a parent directory ([#13472](https://github.com/remix-run/react-router/pull/13472)) |
| 66 | +- When providing a custom Vite config path via the CLI `--config`/`-c` flag, default the project root directory to the directory containing the Vite config when not explicitly provided ([#13472](https://github.com/remix-run/react-router/pull/13472)) |
| 67 | +- In a `routes.ts` context, ensure the `--mode` flag is respected for `import.meta.env.MODE` ([#13485](https://github.com/remix-run/react-router/pull/13485)) |
| 68 | + |
| 69 | + Previously, `import.meta.env.MODE` within a `routes.ts` context was always `"development"` for the `dev` and `typegen --watch` commands, but otherwise resolved to `"production"`. These defaults are still in place, but if a `--mode` flag is provided, this will now take precedence. |
| 70 | + |
| 71 | +- Ensure consistent project root directory resolution logic in CLI commands ([#13472](https://github.com/remix-run/react-router/pull/13472)) |
| 72 | +- When executing `react-router.config.ts` and `routes.ts` with `vite-node`, ensure that PostCSS config files are ignored ([#13489](https://github.com/remix-run/react-router/pull/13489)) |
| 73 | +- When extracting critical CSS during development, ensure it's loaded from the client environment to avoid issues with plugins that handle the SSR environment differently ([#13503](https://github.com/remix-run/react-router/pull/13503)) |
| 74 | +- When `future.unstable_viteEnvironmentApi` is enabled, ensure that `build.assetsDir` in Vite config is respected when `environments.client.build.assetsDir` is not configured ([#13491](https://github.com/remix-run/react-router/pull/13491)) |
| 75 | +- Fix "Status message is not supported by HTTP/2" error during dev when using HTTPS ([#13460](https://github.com/remix-run/react-router/pull/13460)) |
| 76 | +- Update config when `react-router.config.ts` is created or deleted during development. ([#12319](https://github.com/remix-run/react-router/pull/12319)) |
| 77 | +- Skip unnecessary `routes.ts` evaluation before Vite build is started ([#13513](https://github.com/remix-run/react-router/pull/13513)) |
| 78 | +- Fix `TS2300: Duplicate identifier` errors caused by generated types ([#13499](https://github.com/remix-run/react-router/pull/13499)) |
| 79 | + |
| 80 | + Previously, routes that had the same full path would cause duplicate entries in the generated types for `href` (`.react-router/types/+register.ts`), causing type checking errors. |
| 81 | + |
| 82 | +- Updated dependencies: |
| 83 | + |
| 84 | + - `@react-router/[email protected]` |
| 85 | + - `@react-router/[email protected]` |
| 86 | + |
3 | 87 | ## 7.5.3
|
4 | 88 |
|
5 | 89 | ### Patch Changes
|
|
0 commit comments