@react-router/dev 7.1.5 → 7.2.0-pre.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # `@react-router/dev`
2
2
 
3
+ ## 7.2.0-pre.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Generate a "SPA fallback" HTML file for scenarios where applications are prerendering the `/` route with `ssr:false` ([#12948](https://github.com/remix-run/react-router/pull/12948))
8
+
9
+ - If you specify `ssr:false` without a `prerender` config, this is considered "SPA Mode" and the generated `index.html` file will only render down to the root route and will be able to hydrate for any valid application path
10
+ - If you specify `ssr:false` with a `prerender` config but _do not_ include the `/` path (i.e., `prerender: ['/blog/post']`), then we still generate a "SPA Mode" `index.html` file that can hydrate for any path in the application
11
+ - However, previously if you specified `ssr:false` and included the `/` path in your `prerender` config, we would prerender the `/` route into `index.html` as a non-SPA page
12
+ - The generated HTML would include the root index route which prevented hydration for any other paths
13
+ - With this change, we now generate a "SPA Mode" file in `__spa-fallback.html` that will allow you to hydrate for any non-prerendered paths
14
+ - You can serve this file from your static file server for any paths that would otherwise 404 if you only want to pre-render _some_ routes in your `ssr:false` app and serve the others as a SPA
15
+ - `npx sirv-cli build/client --single __spa-fallback.html`
16
+
17
+ - - Allow a `loader` in the root route in SPA mode because it can be called/server-rendered at build time ([#12948](https://github.com/remix-run/react-router/pull/12948))
18
+ - `Route.HydrateFallbackProps` now also receives `loaderData`
19
+ - This will be defined so long as the `HydrateFallback` is rendering while _children_ routes are loading
20
+ - This will be `undefined` if the `HydrateFallback` is rendering because the route has it's own hydrating `clientLoader`
21
+ - In SPA mode, this will allow you to render loader root data into the SPA `index.html`
22
+
23
+ ### Patch Changes
24
+
25
+ - Handle custom `envDir` in Vite config ([#12969](https://github.com/remix-run/react-router/pull/12969))
26
+ - Fix CLI parsing to allow argumentless `npx react-router` usage ([#12925](https://github.com/remix-run/react-router/pull/12925))
27
+ - Skip action-only resource routes when using `prerender:true` ([#13004](https://github.com/remix-run/react-router/pull/13004))
28
+ - Enhance invalid export detection when using `ssr:false` ([#12948](https://github.com/remix-run/react-router/pull/12948))
29
+
30
+ - `headers`/`action` are prohibited in all routes with `ssr:false` because there will be no runtime server on which to run them
31
+ - `loader` functions are more nuanced and depend on whether a given route is prerendered
32
+ - When using `ssr:false` without a `prerender` config, only the `root` route can have a `loader`
33
+ - This is "SPA mode" which generates a single `index.html` file with the root route `HydrateFallback` so it is capable of hydrating for any path in your application - therefore we can only call a root route `loader` at build time
34
+ - When using `ssr:false` with a `prerender` config, you can export a `loader` from routes matched by one of the `prerender` paths because those routes will be server rendered at build time
35
+ - Exporting a `loader` from a route that is never matched by a `prerender` path will throw a build time error because there will be no runtime server to ever run the loader
36
+
37
+ - Limit prerendered resource route `.data` files to only the target route ([#13004](https://github.com/remix-run/react-router/pull/13004))
38
+ - Add unstable support for splitting route modules in framework mode via `future.unstable_splitRouteModules` ([#11871](https://github.com/remix-run/react-router/pull/11871))
39
+ - Add `future.unstable_viteEnvironmentApi` flag to enable experimental Vite Environment API support ([#12936](https://github.com/remix-run/react-router/pull/12936))
40
+ - Disable Lazy Route Discovery for all `ssr:false` apps and not just "SPA Mode" because there is no runtime server to serve the search-param-configured `__manifest` requests ([#12894](https://github.com/remix-run/react-router/pull/12894))
41
+
42
+ - We previously only disabled this for "SPA Mode" which is `ssr:false` and no `prerender` config but we realized it should apply to all `ssr:false` apps, including those prerendering multiple pages
43
+ - In those `prerender` scenarios we would prerender the `/__manifest` file assuming the static file server would serve it but that makes some unneccesary assumptions about the static file server behaviors
44
+
45
+ - Updated dependencies:
46
+ - `react-router@7.2.0-pre.0`
47
+ - `@react-router/node@7.2.0-pre.0`
48
+ - `@react-router/serve@7.2.0-pre.0`
49
+
3
50
  ## 7.1.5
4
51
 
5
52
  ### Patch Changes
@@ -117,7 +164,7 @@
117
164
  +import { cloudflareDevProxy } from "@react-router/dev/vite/cloudflare";
118
165
  ```
119
166
 
120
- - Remove single\_fetch future flag. ([#11522](https://github.com/remix-run/react-router/pull/11522))
167
+ - Remove single_fetch future flag. ([#11522](https://github.com/remix-run/react-router/pull/11522))
121
168
 
122
169
  - update minimum node version to 18 ([#11690](https://github.com/remix-run/react-router/pull/11690))
123
170
 
package/bin.js CHANGED
@@ -5,8 +5,8 @@ let arg = require("arg");
5
5
  // default `NODE_ENV` so React loads the proper version in it's CJS entry script.
6
6
  // We have to do this before importing `run.ts` since that is what imports
7
7
  // `react` (indirectly via `react-router`)
8
- let args = arg({}, { argv: process.argv.slice(2), stopAtPositional: true });
9
- if (args._[0] === "dev") {
8
+ let args = arg({}, { argv: process.argv.slice(2), permissive: true });
9
+ if (args._.length === 0 || args._[0] === "dev") {
10
10
  process.env.NODE_ENV = process.env.NODE_ENV ?? "development";
11
11
  } else {
12
12
  process.env.NODE_ENV = process.env.NODE_ENV ?? "production";