@c0va23/react-router-dev 7.8.3-alpha.1

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 ADDED
@@ -0,0 +1,2512 @@
1
+ # `@react-router/dev`
2
+
3
+ ## 7.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: memory leak in default entry.server ([#14200](https://github.com/remix-run/react-router/pull/14200))
8
+ - Updated dependencies:
9
+ - `react-router@7.8.2`
10
+ - `@react-router/node@7.8.2`
11
+ - `@react-router/serve@7.8.2`
12
+
13
+ ## 7.8.1
14
+
15
+ ### Patch Changes
16
+
17
+ - Update generated `Route.MetaArgs` type so `loaderData` is only potentially undefined when an `ErrorBoundary` export is present ([#14173](https://github.com/remix-run/react-router/pull/14173))
18
+ - Updated dependencies:
19
+ - `react-router@7.8.1`
20
+ - `@react-router/node@7.8.1`
21
+ - `@react-router/serve@7.8.1`
22
+
23
+ ## 7.8.0
24
+
25
+ ### Patch Changes
26
+
27
+ - Fix rename without mkdir in Vite plugin ([#14105](https://github.com/remix-run/react-router/pull/14105))
28
+ - Updated dependencies:
29
+ - `react-router@7.8.0`
30
+ - `@react-router/node@7.8.0`
31
+ - `@react-router/serve@7.8.0`
32
+
33
+ ## 7.7.1
34
+
35
+ ### Patch Changes
36
+
37
+ - Update to Prettier v3 for formatting when running `react-router reveal --no-typescript` ([#14049](https://github.com/remix-run/react-router/pull/14049))
38
+ - Updated dependencies:
39
+ - `react-router@7.7.1`
40
+ - `@react-router/node@7.7.1`
41
+ - `@react-router/serve@7.7.1`
42
+
43
+ ## 7.7.0
44
+
45
+ ### Patch Changes
46
+
47
+ - Update `vite-node` to `^3.2.2` to support Vite 7 ([#13781](https://github.com/remix-run/react-router/pull/13781))
48
+ - Properly handle `https` protocol in dev mode ([#13746](https://github.com/remix-run/react-router/pull/13746))
49
+ - Fix missing styles when Vite's `build.cssCodeSplit` option is disabled ([#13943](https://github.com/remix-run/react-router/pull/13943))
50
+ - Allow `.mts` and `.mjs` extensions for route config file ([#13931](https://github.com/remix-run/react-router/pull/13931))
51
+ - Fix prerender file locations when `cwd` differs from project root ([#13824](https://github.com/remix-run/react-router/pull/13824))
52
+ - Improve chunk error logging when a chunk cannot be found during the build ([#13799](https://github.com/remix-run/react-router/pull/13799))
53
+ - Fix incorrectly configured `externalConditions` which had enabled `module` condition for externals and broke builds with certain packages, like Emotion. ([#13871](https://github.com/remix-run/react-router/pull/13871))
54
+ - Updated dependencies:
55
+ - `react-router@7.7.0`
56
+ - `@react-router/node@7.7.0`
57
+ - `@react-router/serve@7.7.0`
58
+
59
+ ## 7.6.3
60
+
61
+ ### Patch Changes
62
+
63
+ - Add Vite 7 support ([#13748](https://github.com/remix-run/react-router/pull/13748))
64
+ - Skip `package.json` resolution checks when a custom `entry.server.(j|t)sx` file is provided. ([#13744](https://github.com/remix-run/react-router/pull/13744))
65
+ - Add validation for a route's id not being 'root' ([#13792](https://github.com/remix-run/react-router/pull/13792))
66
+ - Updated dependencies:
67
+ - `@react-router/node@7.6.3`
68
+ - `react-router@7.6.3`
69
+ - `@react-router/serve@7.6.3`
70
+
71
+ ## 7.6.2
72
+
73
+ ### Patch Changes
74
+
75
+ - Avoid additional `with-props` chunk in Framework Mode by moving route module component prop logic from the Vite plugin to `react-router` ([#13650](https://github.com/remix-run/react-router/pull/13650))
76
+
77
+ - When `future.unstable_viteEnvironmentApi` is enabled and an absolute Vite `base` has been configured, ensure critical CSS is handled correctly during development ([#13598](https://github.com/remix-run/react-router/pull/13598))
78
+
79
+ - Update `vite-node` ([#13673](https://github.com/remix-run/react-router/pull/13673))
80
+
81
+ - Fix typegen for non-{.js,.jsx,.ts,.tsx} routes like .mdx ([#12453](https://github.com/remix-run/react-router/pull/12453))
82
+
83
+ - Fix href types for optional dynamic params ([#13725](https://github.com/remix-run/react-router/pull/13725))
84
+
85
+ 7.6.1 introduced fixes for `href` when using optional static segments,
86
+ but those fixes caused regressions with how optional dynamic params worked in 7.6.0:
87
+
88
+ ```ts
89
+ // 7.6.0
90
+ href("/users/:id?"); // ✅
91
+ href("/users/:id?", { id: 1 }); // ✅
92
+
93
+ // 7.6.1
94
+ href("/users/:id?"); // ❌
95
+ href("/users/:id?", { id: 1 }); // ❌
96
+ ```
97
+
98
+ Now, optional static segments are expanded into different paths for `href`, but optional dynamic params are not.
99
+ This way `href` can unambiguously refer to an exact URL path, all while keeping the number of path options to a minimum.
100
+
101
+ ```ts
102
+ // 7.6.2
103
+
104
+ // path: /users/:id?/edit?
105
+ href("
106
+ // ^ suggestions when cursor is here:
107
+ //
108
+ // /users/:id?
109
+ // /users/:id?/edit
110
+ ```
111
+
112
+ Additionally, you can pass `params` from component props without needing to narrow them manually:
113
+
114
+ ```ts
115
+ declare const params: { id?: number };
116
+
117
+ // 7.6.0
118
+ href("/users/:id?", params);
119
+
120
+ // 7.6.1
121
+ href("/users/:id?", params); // ❌
122
+ "id" in params ? href("/users/:id", params) : href("/users"); // works... but is annoying
123
+
124
+ // 7.6.2
125
+ href("/users/:id?", params); // restores behavior of 7.6.0
126
+ ```
127
+
128
+ - Updated dependencies:
129
+ - `react-router@7.6.2`
130
+ - `@react-router/node@7.6.2`
131
+ - `@react-router/serve@7.6.2`
132
+
133
+ ## 7.6.1
134
+
135
+ ### Patch Changes
136
+
137
+ - Prevent typegen with route files are outside the app directory ([#12996](https://github.com/remix-run/react-router/pull/12996))
138
+
139
+ - Fix typegen when same route is used at multiple paths ([#13574](https://github.com/remix-run/react-router/pull/13574))
140
+
141
+ For example, `routes/route.tsx` is used at 4 different paths here:
142
+
143
+ ```ts
144
+ import { type RouteConfig, route } from "@react-router/dev/routes";
145
+ export default [
146
+ route("base/:base", "routes/base.tsx", [
147
+ route("home/:home", "routes/route.tsx", { id: "home" }),
148
+ route("changelog/:changelog", "routes/route.tsx", { id: "changelog" }),
149
+ route("splat/*", "routes/route.tsx", { id: "splat" }),
150
+ ]),
151
+ route("other/:other", "routes/route.tsx", { id: "other" }),
152
+ ] satisfies RouteConfig;
153
+ ```
154
+
155
+ Previously, typegen would arbitrarily pick one of these paths to be the "winner" and generate types for the route module based on that path.
156
+ Now, typegen creates unions as necessary for alternate paths for the same route file.
157
+
158
+ - Add additional logging to `build` command output when cleaning assets from server build ([#13547](https://github.com/remix-run/react-router/pull/13547))
159
+
160
+ - Better types for `params` ([#13543](https://github.com/remix-run/react-router/pull/13543))
161
+
162
+ For example:
163
+
164
+ ```ts
165
+ // routes.ts
166
+ import { type RouteConfig, route } from "@react-router/dev/routes";
167
+
168
+ export default [
169
+ route("parent/:p", "routes/parent.tsx", [
170
+ route("layout/:l", "routes/layout.tsx", [
171
+ route("child1/:c1a/:c1b", "routes/child1.tsx"),
172
+ route("child2/:c2a/:c2b", "routes/child2.tsx"),
173
+ ]),
174
+ ]),
175
+ ] satisfies RouteConfig;
176
+ ```
177
+
178
+ Previously, `params` for the `routes/layout.tsx` route were calculated as `{ p: string, l: string }`.
179
+ This incorrectly ignores params that could come from child routes.
180
+ If visiting `/parent/1/layout/2/child1/3/4`, the actual params passed to `routes/layout.tsx` will have a type of `{ p: string, l: string, c1a: string, c1b: string }`.
181
+
182
+ Now, `params` are aware of child routes and autocompletion will include child params as optionals:
183
+
184
+ ```ts
185
+ params.|
186
+ // ^ cursor is here and you ask for autocompletion
187
+ // p: string
188
+ // l: string
189
+ // c1a?: string
190
+ // c1b?: string
191
+ // c2a?: string
192
+ // c2b?: string
193
+ ```
194
+
195
+ You can also narrow the types for `params` as it is implemented as a normalized union of params for each page that includes `routes/layout.tsx`:
196
+
197
+ ```ts
198
+ if (typeof params.c1a === 'string') {
199
+ params.|
200
+ // ^ cursor is here and you ask for autocompletion
201
+ // p: string
202
+ // l: string
203
+ // c1a: string
204
+ // c1b: string
205
+ }
206
+ ```
207
+
208
+ ***
209
+
210
+ UNSTABLE: renamed internal `react-router/route-module` export to `react-router/internal`
211
+ UNSTABLE: removed `Info` export from generated `+types/*` files
212
+
213
+ - \[UNSTABLE] Normalize dirent entry path across node versions when generating SRI manifest ([#13591](https://github.com/remix-run/react-router/pull/13591))
214
+
215
+ - Don't clean assets from server build when `build.ssrEmitAssets` has been enabled in Vite config ([#13547](https://github.com/remix-run/react-router/pull/13547))
216
+
217
+ - Fix `href` for optional segments ([#13595](https://github.com/remix-run/react-router/pull/13595))
218
+
219
+ Type generation now expands paths with optionals into their corresponding non-optional paths.
220
+ For example, the path `/user/:id?` gets expanded into `/user` and `/user/:id` to more closely model visitable URLs.
221
+ `href` then uses these expanded (non-optional) paths to construct type-safe paths for your app:
222
+
223
+ ```ts
224
+ // original: /user/:id?
225
+ // expanded: /user & /user/:id
226
+ href("/user"); // ✅
227
+ href("/user/:id", { id: 1 }); // ✅
228
+ ```
229
+
230
+ This becomes even more important for static optional paths where there wasn't a good way to indicate whether the optional should be included in the resulting path:
231
+
232
+ ```ts
233
+ // original: /products/:id/detail?
234
+
235
+ // before
236
+ href("/products/:id/detail?"); // ❌ How can we tell `href` to include or omit `detail?` segment with a complex API?
237
+
238
+ // now
239
+ // expanded: /products/:id & /products/:id/detail
240
+ href("/product/:id"); // ✅
241
+ href("/product/:id/detail"); // ✅
242
+ ```
243
+
244
+ - Updated dependencies:
245
+ - `react-router@7.6.1`
246
+ - `@react-router/node@7.6.1`
247
+ - `@react-router/serve@7.6.1`
248
+
249
+ ## 7.6.0
250
+
251
+ ### Minor Changes
252
+
253
+ - 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))
254
+ - By default, Lazy Route Discovery is enabled and makes manifest requests to the `/__manifest` path:
255
+ - `routeDiscovery: { mode: "lazy", manifestPath: "/__manifest" }`
256
+ - You can modify the manifest path used:
257
+ - `routeDiscovery: { mode: "lazy", manifestPath: "/custom-manifest" }`
258
+ - Or you can disable this feature entirely and include all routes in the manifest on initial document load:
259
+ - `routeDiscovery: { mode: "initial" }`
260
+
261
+ - Automatic types for future flags ([#13506](https://github.com/remix-run/react-router/pull/13506))
262
+
263
+ Some future flags alter the way types should work in React Router.
264
+ Previously, you had to remember to manually opt-in to the new types.
265
+
266
+ For example, for `unstable_middleware`:
267
+
268
+ ```ts
269
+ // react-router.config.ts
270
+
271
+ // Step 1: Enable middleware
272
+ export default {
273
+ future: {
274
+ unstable_middleware: true,
275
+ },
276
+ };
277
+
278
+ // Step 2: Enable middleware types
279
+ declare module "react-router" {
280
+ interface Future {
281
+ unstable_middleware: true; // 👈 Enable middleware types
282
+ }
283
+ }
284
+ ```
285
+
286
+ It was up to you to keep the runtime future flags synced with the types for those future flags.
287
+ This was confusing and error-prone.
288
+
289
+ Now, React Router will automatically enable types for future flags.
290
+ That means you only need to specify the runtime future flag:
291
+
292
+ ```ts
293
+ // react-router.config.ts
294
+
295
+ // Step 1: Enable middleware
296
+ export default {
297
+ future: {
298
+ unstable_middleware: true,
299
+ },
300
+ };
301
+
302
+ // No step 2! That's it!
303
+ ```
304
+
305
+ Behind the scenes, React Router will generate the corresponding `declare module` into `.react-router/types`.
306
+ Currently this is done in `.react-router/types/+register.ts` but this is an implementation detail that may change in the future.
307
+
308
+ ### Patch Changes
309
+
310
+ - 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))
311
+
312
+ - 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))
313
+
314
+ - 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))
315
+
316
+ 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.
317
+
318
+ - Ensure consistent project root directory resolution logic in CLI commands ([#13472](https://github.com/remix-run/react-router/pull/13472))
319
+
320
+ - 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))
321
+
322
+ - 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))
323
+
324
+ - 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))
325
+
326
+ - 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))
327
+
328
+ - Update config when `react-router.config.ts` is created or deleted during development. ([#12319](https://github.com/remix-run/react-router/pull/12319))
329
+
330
+ - Skip unnecessary `routes.ts` evaluation before Vite build is started ([#13513](https://github.com/remix-run/react-router/pull/13513))
331
+
332
+ - Fix `TS2300: Duplicate identifier` errors caused by generated types ([#13499](https://github.com/remix-run/react-router/pull/13499))
333
+
334
+ 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.
335
+
336
+ - Updated dependencies:
337
+ - `react-router@7.6.0`
338
+ - `@react-router/node@7.6.0`
339
+ - `@react-router/serve@7.6.0`
340
+
341
+ ## 7.5.3
342
+
343
+ ### Patch Changes
344
+
345
+ - Updated dependencies:
346
+ - `react-router@7.5.3`
347
+ - `@react-router/node@7.5.3`
348
+ - `@react-router/serve@7.5.3`
349
+
350
+ ## 7.5.2
351
+
352
+ ### Patch Changes
353
+
354
+ - Adjust approach for Prerendering/SPA Mode via headers ([#13453](https://github.com/remix-run/react-router/pull/13453))
355
+ - Updated dependencies:
356
+ - `react-router@7.5.2`
357
+ - `@react-router/node@7.5.2`
358
+ - `@react-router/serve@7.5.2`
359
+
360
+ ## 7.5.1
361
+
362
+ ### Patch Changes
363
+
364
+ - Fix prerendering when a loader returns a redirect ([#13365](https://github.com/remix-run/react-router/pull/13365))
365
+ - Updated dependencies:
366
+ - `react-router@7.5.1`
367
+ - `@react-router/node@7.5.1`
368
+ - `@react-router/serve@7.5.1`
369
+
370
+ ## 7.5.0
371
+
372
+ ### Patch Changes
373
+
374
+ - Introduce `unstable_subResourceIntegrity` future flag that enables generation of an importmap with integrity for the scripts that will be loaded by the browser. ([#13163](https://github.com/remix-run/react-router/pull/13163))
375
+ - Update optional Wrangler peer dependency range to support Wrangler v4 ([#13258](https://github.com/remix-run/react-router/pull/13258))
376
+ - When `future.unstable_viteEnvironmentApi` is enabled, ensure critical CSS in development works when using a custom Vite `base` has been configured ([#13305](https://github.com/remix-run/react-router/pull/13305))
377
+ - 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 ([#13317](https://github.com/remix-run/react-router/pull/13317))
378
+ - Updated dependencies:
379
+ - `react-router@7.5.0`
380
+ - `@react-router/node@7.5.0`
381
+ - `@react-router/serve@7.5.0`
382
+
383
+ ## 7.4.1
384
+
385
+ ### Patch Changes
386
+
387
+ - Fix path in prerender error messages ([#13257](https://github.com/remix-run/react-router/pull/13257))
388
+ - Fix typegen for virtual modules when `moduleDetection` is set to `force` ([#13267](https://github.com/remix-run/react-router/pull/13267))
389
+ - When both `future.unstable_middleware` and `future.unstable_splitRouteModules` are enabled, split `unstable_clientMiddleware` route exports into separate chunks when possible ([#13210](https://github.com/remix-run/react-router/pull/13210))
390
+ - Improve performance of `future.unstable_middleware` by ensuring that route modules are only blocking during the middleware phase when the `unstable_clientMiddleware` has been defined ([#13210](https://github.com/remix-run/react-router/pull/13210))
391
+ - Updated dependencies:
392
+ - `react-router@7.4.1`
393
+ - `@react-router/node@7.4.1`
394
+ - `@react-router/serve@7.4.1`
395
+
396
+ ## 7.4.0
397
+
398
+ ### Minor Changes
399
+
400
+ - Generate types for `virtual:react-router/server-build` module ([#13152](https://github.com/remix-run/react-router/pull/13152))
401
+
402
+ ### Patch Changes
403
+
404
+ - When `future.unstable_splitRouteModules` is set to `"enforce"`, allow both splittable and unsplittable root route exports since it's always in a single chunk. ([#13238](https://github.com/remix-run/react-router/pull/13238))
405
+ - When `future.unstable_viteEnvironmentApi` is enabled, allow plugins that override the default SSR environment (such as `@cloudflare/vite-plugin`) to be placed before or after the React Router plugin. ([#13183](https://github.com/remix-run/react-router/pull/13183))
406
+ - Fix conflicts with other Vite plugins that use the `configureServer` and/or `configurePreviewServer` hooks ([#13184](https://github.com/remix-run/react-router/pull/13184))
407
+ - Updated dependencies:
408
+ - `react-router@7.4.0`
409
+ - `@react-router/node@7.4.0`
410
+ - `@react-router/serve@7.4.0`
411
+
412
+ ## 7.3.0
413
+
414
+ ### Patch Changes
415
+
416
+ - Fix support for custom client `build.rollupOptions.output.entryFileNames` ([#13098](https://github.com/remix-run/react-router/pull/13098))
417
+
418
+ - Fix usage of `prerender` option when `serverBundles` option has been configured or provided by a preset, e.g. `vercelPreset` from `@vercel/react-router` ([#13082](https://github.com/remix-run/react-router/pull/13082))
419
+
420
+ - Fix support for custom `build.assetsDir` ([#13077](https://github.com/remix-run/react-router/pull/13077))
421
+
422
+ - Remove unused dependencies ([#13134](https://github.com/remix-run/react-router/pull/13134))
423
+
424
+ - Stub all routes except root in "SPA Mode" server builds to avoid issues when route modules or their dependencies import non-SSR-friendly modules ([#13023](https://github.com/remix-run/react-router/pull/13023))
425
+
426
+ - Fix errors with `future.unstable_viteEnvironmentApi` when the `ssr` environment has been configured by another plugin to be a custom `Vite.DevEnvironment` rather than the default `Vite.RunnableDevEnvironment` ([#13008](https://github.com/remix-run/react-router/pull/13008))
427
+
428
+ - Remove unused Vite file system watcher ([#13133](https://github.com/remix-run/react-router/pull/13133))
429
+
430
+ - Fix support for custom SSR build input when `serverBundles` option has been configured ([#13107](https://github.com/remix-run/react-router/pull/13107))
431
+
432
+ Note that for consumers using the `future.unstable_viteEnvironmentApi` and `serverBundles` options together, hyphens are no longer supported in server bundle IDs since they also need to be valid Vite environment names.
433
+
434
+ - Fix dev server when using HTTPS by stripping HTTP/2 pseudo headers from dev server requests ([#12830](https://github.com/remix-run/react-router/pull/12830))
435
+
436
+ - Lazy load Cloudflare platform proxy on first dev server request when using the `cloudflareDevProxy` Vite plugin to avoid creating unnecessary workerd processes ([#13016](https://github.com/remix-run/react-router/pull/13016))
437
+
438
+ - When `future.unstable_viteEnvironmentApi` is enabled and the `ssr` environment has `optimizeDeps.noDiscovery` disabled, define `optimizeDeps.entries` and `optimizeDeps.include` ([#13007](https://github.com/remix-run/react-router/pull/13007))
439
+
440
+ - Fix duplicated entries in typegen for layout routes and their corresponding index route ([#13140](https://github.com/remix-run/react-router/pull/13140))
441
+
442
+ - Updated dependencies:
443
+ - `react-router@7.3.0`
444
+ - `@react-router/node@7.3.0`
445
+ - `@react-router/serve@7.3.0`
446
+
447
+ ## 7.2.0
448
+
449
+ ### Minor Changes
450
+
451
+ - 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))
452
+ - 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
453
+ - 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
454
+ - 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
455
+ - The generated HTML would include the root index route which prevented hydration for any other paths
456
+ - 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
457
+ - 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
458
+ - `npx sirv-cli build/client --single __spa-fallback.html`
459
+
460
+ - 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))
461
+ - `Route.HydrateFallbackProps` now also receives `loaderData`
462
+ - This will be defined so long as the `HydrateFallback` is rendering while _children_ routes are loading
463
+ - This will be `undefined` if the `HydrateFallback` is rendering because the route has it's own hydrating `clientLoader`
464
+ - In SPA mode, this will allow you to render loader root data into the SPA `index.html`
465
+
466
+ - New type-safe `href` utility that guarantees links point to actual paths in your app ([#13012](https://github.com/remix-run/react-router/pull/13012))
467
+
468
+ ```tsx
469
+ import { href } from "react-router";
470
+
471
+ export default function Component() {
472
+ const link = href("/blog/:slug", { slug: "my-first-post" });
473
+ return (
474
+ <main>
475
+ <Link to={href("/products/:id", { id: "asdf" })} />
476
+ <NavLink to={href("/:lang?/about", { lang: "en" })} />
477
+ </main>
478
+ );
479
+ }
480
+ ```
481
+
482
+ ### Patch Changes
483
+
484
+ - Handle custom `envDir` in Vite config ([#12969](https://github.com/remix-run/react-router/pull/12969))
485
+
486
+ - Fix typegen for repeated params ([#13012](https://github.com/remix-run/react-router/pull/13012))
487
+
488
+ In React Router, path parameters are keyed by their name.
489
+ So for a path pattern like `/a/:id/b/:id?/c/:id`, the last `:id` will set the value for `id` in `useParams` and the `params` prop.
490
+ For example, `/a/1/b/2/c/3` will result in the value `{ id: 3 }` at runtime.
491
+
492
+ Previously, generated types for params incorrectly modeled repeated params with an array.
493
+ So `/a/1/b/2/c/3` generated a type like `{ id: [1,2,3] }`.
494
+
495
+ To be consistent with runtime behavior, the generated types now correctly model the "last one wins" semantics of path parameters.
496
+ So `/a/1/b/2/c/3` now generates a type like `{ id: 3 }`.
497
+
498
+ - Fix CLI parsing to allow argumentless `npx react-router` usage ([#12925](https://github.com/remix-run/react-router/pull/12925))
499
+
500
+ - Fix `ArgError: unknown or unexpected option: --version` when running `react-router --version` ([#13012](https://github.com/remix-run/react-router/pull/13012))
501
+
502
+ - Skip action-only resource routes when using `prerender:true` ([#13004](https://github.com/remix-run/react-router/pull/13004))
503
+
504
+ - Enhance invalid export detection when using `ssr:false` ([#12948](https://github.com/remix-run/react-router/pull/12948))
505
+ - `headers`/`action` are prohibited in all routes with `ssr:false` because there will be no runtime server on which to run them
506
+ - `loader` functions are more nuanced and depend on whether a given route is prerendered
507
+ - When using `ssr:false` without a `prerender` config, only the `root` route can have a `loader`
508
+ - 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
509
+ - 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
510
+ - 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
511
+
512
+ - Limit prerendered resource route `.data` files to only the target route ([#13004](https://github.com/remix-run/react-router/pull/13004))
513
+
514
+ - Add unstable support for splitting route modules in framework mode via `future.unstable_splitRouteModules` ([#11871](https://github.com/remix-run/react-router/pull/11871))
515
+
516
+ - Fix prerendering of binary files ([#13039](https://github.com/remix-run/react-router/pull/13039))
517
+
518
+ - Add `future.unstable_viteEnvironmentApi` flag to enable experimental Vite Environment API support ([#12936](https://github.com/remix-run/react-router/pull/12936))
519
+
520
+ - 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))
521
+ - 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
522
+ - 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
523
+
524
+ - Updated dependencies:
525
+ - `react-router@7.2.0`
526
+ - `@react-router/node@7.2.0`
527
+ - `@react-router/serve@7.2.0`
528
+
529
+ ## 7.1.5
530
+
531
+ ### Patch Changes
532
+
533
+ - Updated dependencies:
534
+ - `react-router@7.1.5`
535
+ - `@react-router/node@7.1.5`
536
+ - `@react-router/serve@7.1.5`
537
+
538
+ ## 7.1.4
539
+
540
+ ### Patch Changes
541
+
542
+ - Properly resolve Windows file paths to scan for Vite's dependency optimization when using the `unstable_optimizeDeps` future flag. ([#12637](https://github.com/remix-run/react-router/pull/12637))
543
+ - Fix prerendering when using a custom server - previously we ended up trying to import the users custom server when we actually want to import the virtual server build module ([#12759](https://github.com/remix-run/react-router/pull/12759))
544
+ - Updated dependencies:
545
+ - `react-router@7.1.4`
546
+ - `@react-router/node@7.1.4`
547
+ - `@react-router/serve@7.1.4`
548
+
549
+ ## 7.1.3
550
+
551
+ ### Patch Changes
552
+
553
+ - Fix `reveal` and `routes` CLI commands ([#12745](https://github.com/remix-run/react-router/pull/12745))
554
+ - Updated dependencies:
555
+ - `react-router@7.1.3`
556
+ - `@react-router/node@7.1.3`
557
+ - `@react-router/serve@7.1.3`
558
+
559
+ ## 7.1.2
560
+
561
+ ### Patch Changes
562
+
563
+ - Fix default external conditions in Vite v6. This fixes resolution issues with certain npm packages. ([#12644](https://github.com/remix-run/react-router/pull/12644))
564
+ - Fix mismatch in prerendering html/data files when path is missing a leading slash ([#12684](https://github.com/remix-run/react-router/pull/12684))
565
+ - Use `module-sync` server condition when enabled in the runtime. This fixes React context mismatches (e.g. `useHref() may be used only in the context of a <Router> component.`) during development on Node 22.10.0+ when using libraries that have a peer dependency on React Router. ([#12729](https://github.com/remix-run/react-router/pull/12729))
566
+ - Fix react-refresh source maps ([#12686](https://github.com/remix-run/react-router/pull/12686))
567
+ - Updated dependencies:
568
+ - `react-router@7.1.2`
569
+ - `@react-router/node@7.1.2`
570
+ - `@react-router/serve@7.1.2`
571
+
572
+ ## 7.1.1
573
+
574
+ ### Patch Changes
575
+
576
+ - Fix for a crash when optional args are passed to the CLI ([`5b1ca202f`](https://github.com/remix-run/react-router/commit/5b1ca202f77ef342db0109c6b791d33188077cd0))
577
+ - Updated dependencies:
578
+ - `react-router@7.1.1`
579
+ - `@react-router/node@7.1.1`
580
+ - `@react-router/serve@7.1.1`
581
+
582
+ ## 7.1.0
583
+
584
+ ### Minor Changes
585
+
586
+ - Add support for Vite v6 ([#12469](https://github.com/remix-run/react-router/pull/12469))
587
+
588
+ ### Patch Changes
589
+
590
+ - Properly initialize `NODE_ENV` if not already set for compatibility with React 19 ([#12578](https://github.com/remix-run/react-router/pull/12578))
591
+
592
+ - Remove the leftover/unused `abortDelay` prop from `ServerRouter` and update the default `entry.server.tsx` to use the new `streamTimeout` value for Single Fetch ([#12478](https://github.com/remix-run/react-router/pull/12478))
593
+ - The `abortDelay` functionality was removed in v7 as it was coupled to the `defer` implementation from Remix v2, but this removal of this prop was missed
594
+ - If you were still using this prop in your `entry.server` file, it's likely your app is not aborting streams as you would expect and you will need to adopt the new [`streamTimeout`](https://reactrouter.com/explanation/special-files#streamtimeout) value introduced with Single Fetch
595
+
596
+ - Updated dependencies:
597
+ - `react-router@7.1.0`
598
+ - `@react-router/node@7.1.0`
599
+ - `@react-router/serve@7.1.0`
600
+
601
+ ## 7.0.2
602
+
603
+ ### Patch Changes
604
+
605
+ - Support `moduleResolution` `Node16` and `NodeNext` ([#12440](https://github.com/remix-run/react-router/pull/12440))
606
+
607
+ - Generate wide `matches` and `params` types for current route and child routes ([#12397](https://github.com/remix-run/react-router/pull/12397))
608
+
609
+ At runtime, `matches` includes child route matches and `params` include child route path parameters.
610
+ But previously, we only generated types for parent routes in `matches`; for `params`, we only considered the parent routes and the current route.
611
+ To align our generated types more closely to the runtime behavior, we now generate more permissive, wider types when accessing child route information.
612
+
613
+ - Updated dependencies:
614
+ - `react-router@7.0.2`
615
+ - `@react-router/node@7.0.2`
616
+ - `@react-router/serve@7.0.2`
617
+
618
+ ## 7.0.1
619
+
620
+ ### Patch Changes
621
+
622
+ - Pass route error to ErrorBoundary as a prop ([#12338](https://github.com/remix-run/react-router/pull/12338))
623
+ - Ensure typegen file watcher is cleaned up when Vite dev server restarts ([#12331](https://github.com/remix-run/react-router/pull/12331))
624
+ - Updated dependencies:
625
+ - `react-router@7.0.1`
626
+ - `@react-router/node@7.0.1`
627
+ - `@react-router/serve@7.0.1`
628
+
629
+ ## 7.0.0
630
+
631
+ ### Major Changes
632
+
633
+ - For Remix consumers migrating to React Router, the `vitePlugin` and `cloudflareDevProxyVitePlugin` exports have been renamed and moved. ([#11904](https://github.com/remix-run/react-router/pull/11904))
634
+
635
+ ```diff
636
+ -import {
637
+ - vitePlugin as remix,
638
+ - cloudflareDevProxyVitePlugin,
639
+ -} from "@remix/dev";
640
+
641
+ +import { reactRouter } from "@react-router/dev/vite";
642
+ +import { cloudflareDevProxy } from "@react-router/dev/vite/cloudflare";
643
+ ```
644
+
645
+ - Remove single fetch future flag. ([#11522](https://github.com/remix-run/react-router/pull/11522))
646
+
647
+ - update minimum node version to 18 ([#11690](https://github.com/remix-run/react-router/pull/11690))
648
+
649
+ - Add `exports` field to all packages ([#11675](https://github.com/remix-run/react-router/pull/11675))
650
+
651
+ - node package no longer re-exports from react-router ([#11702](https://github.com/remix-run/react-router/pull/11702))
652
+
653
+ - For Remix consumers migrating to React Router who used the Vite plugin's `buildEnd` hook, the resolved `reactRouterConfig` object no longer contains a `publicPath` property since this belongs to Vite, not React Router. ([#11575](https://github.com/remix-run/react-router/pull/11575))
654
+
655
+ - For Remix consumers migrating to React Router, the Vite plugin's `manifest` option has been removed. ([#11573](https://github.com/remix-run/react-router/pull/11573))
656
+
657
+ The `manifest` option been superseded by the more powerful `buildEnd` hook since it's passed the `buildManifest` argument. You can still write the build manifest to disk if needed, but you'll most likely find it more convenient to write any logic depending on the build manifest within the `buildEnd` hook itself.
658
+
659
+ If you were using the `manifest` option, you can replace it with a `buildEnd` hook that writes the manifest to disk like this:
660
+
661
+ ```ts
662
+ // react-router.config.ts
663
+ import type { Config } from "@react-router/dev/config";
664
+ import { writeFile } from "node:fs/promises";
665
+
666
+ export default {
667
+ async buildEnd({ buildManifest }) {
668
+ await writeFile(
669
+ "build/manifest.json",
670
+ JSON.stringify(buildManifest, null, 2),
671
+ "utf-8",
672
+ );
673
+ },
674
+ } satisfies Config;
675
+ ```
676
+
677
+ - Consolidate types previously duplicated across `@remix-run/router`, `@remix-run/server-runtime`, and `@remix-run/react` now that they all live in `react-router` ([#12177](https://github.com/remix-run/react-router/pull/12177))
678
+ - Examples: `LoaderFunction`, `LoaderFunctionArgs`, `ActionFunction`, `ActionFunctionArgs`, `DataFunctionArgs`, `RouteManifest`, `LinksFunction`, `Route`, `EntryRoute`
679
+ - The `RouteManifest` type used by the "remix" code is now slightly stricter because it is using the former `@remix-run/router` `RouteManifest`
680
+ - `Record<string, Route> -> Record<string, Route | undefined>`
681
+ - Removed `AppData` type in favor of inlining `unknown` in the few locations it was used
682
+ - Removed `ServerRuntimeMeta*` types in favor of the `Meta*` types they were duplicated from
683
+
684
+ - Update default `isbot` version to v5 and drop support for `isbot@3` ([#11770](https://github.com/remix-run/react-router/pull/11770))
685
+ - If you have `isbot@4` or `isbot@5` in your `package.json`:
686
+ - You do not need to make any changes
687
+ - If you have `isbot@3` in your `package.json` and you have your own `entry.server.tsx` file in your repo
688
+ - You do not need to make any changes
689
+ - You can upgrade to `isbot@5` independent of the React Router v7 upgrade
690
+ - If you have `isbot@3` in your `package.json` and you do not have your own `entry.server.tsx` file in your repo
691
+ - You are using the internal default entry provided by React Router v7 and you will need to upgrade to `isbot@5` in your `package.json`
692
+
693
+ - Drop support for Node 18, update minimum Node vestion to 20 ([#12171](https://github.com/remix-run/react-router/pull/12171))
694
+ - Remove `installGlobals()` as this should no longer be necessary
695
+
696
+ - For Remix consumers migrating to React Router, Vite manifests (i.e. `.vite/manifest.json`) are now written within each build subdirectory, e.g. `build/client/.vite/manifest.json` and `build/server/.vite/manifest.json` instead of `build/.vite/client-manifest.json` and `build/.vite/server-manifest.json`. This means that the build output is now much closer to what you'd expect from a typical Vite project. ([#11573](https://github.com/remix-run/react-router/pull/11573))
697
+
698
+ Originally the Remix Vite plugin moved all Vite manifests to a root-level `build/.vite` directory to avoid accidentally serving them in production, particularly from the client build. This was later improved with additional logic that deleted these Vite manifest files at the end of the build process unless Vite's `build.manifest` had been enabled within the app's Vite config. This greatly reduced the risk of accidentally serving the Vite manifests in production since they're only present when explicitly asked for. As a result, we can now assume that consumers will know that they need to manage these additional files themselves, and React Router can safely generate a more standard Vite build output.
699
+
700
+ ### Minor Changes
701
+
702
+ - Params, loader data, and action data as props for route component exports ([#11961](https://github.com/remix-run/react-router/pull/11961))
703
+
704
+ ```tsx
705
+ export default function Component({ params, loaderData, actionData }) {}
706
+
707
+ export function HydrateFallback({ params }) {}
708
+ export function ErrorBoundary({ params, loaderData, actionData }) {}
709
+ ```
710
+
711
+ - Remove internal entry.server.spa.tsx implementation ([#11681](https://github.com/remix-run/react-router/pull/11681))
712
+
713
+ - Add `prefix` route config helper to `@react-router/dev/routes` ([#12094](https://github.com/remix-run/react-router/pull/12094))
714
+
715
+ - ### Typesafety improvements ([#12019](https://github.com/remix-run/react-router/pull/12019))
716
+
717
+ React Router now generates types for each of your route modules.
718
+ You can access those types by importing them from `./+types.<route filename without extension>`.
719
+ For example:
720
+
721
+ ```ts
722
+ // app/routes/product.tsx
723
+ import type * as Route from "./+types.product";
724
+
725
+ export function loader({ params }: Route.LoaderArgs) {}
726
+
727
+ export default function Component({ loaderData }: Route.ComponentProps) {}
728
+ ```
729
+
730
+ This initial implementation targets type inference for:
731
+ - `Params` : Path parameters from your routing config in `routes.ts` including file-based routing
732
+ - `LoaderData` : Loader data from `loader` and/or `clientLoader` within your route module
733
+ - `ActionData` : Action data from `action` and/or `clientAction` within your route module
734
+
735
+ In the future, we plan to add types for the rest of the route module exports: `meta`, `links`, `headers`, `shouldRevalidate`, etc.
736
+ We also plan to generate types for typesafe `Link`s:
737
+
738
+ ```tsx
739
+ <Link to="/products/:id" params={{ id: 1 }} />
740
+ // ^^^^^^^^^^^^^ ^^^^^^^^^
741
+ // typesafe `to` and `params` based on the available routes in your app
742
+ ```
743
+
744
+ Check out our docs for more:
745
+ - [_Explanations > Type Safety_](https://reactrouter.com/dev/guides/explanation/type-safety)
746
+ - [_How-To > Setting up type safety_](https://reactrouter.com/dev/guides/how-to/setting-up-type-safety)
747
+
748
+ ### Patch Changes
749
+
750
+ - Enable prerendering for resource routes ([#12200](https://github.com/remix-run/react-router/pull/12200))
751
+ - chore: warn instead of error for min node version in CLI ([#12270](https://github.com/remix-run/react-router/pull/12270))
752
+ - chore: re-enable development warnings through a `development` exports condition. ([#12269](https://github.com/remix-run/react-router/pull/12269))
753
+ - include root "react-dom" module for optimization ([#12060](https://github.com/remix-run/react-router/pull/12060))
754
+ - resolve config directory relative to flat output file structure ([#12187](https://github.com/remix-run/react-router/pull/12187))
755
+ - if we are in SAP mode, always render the `index.html` for hydration ([#12268](https://github.com/remix-run/react-router/pull/12268))
756
+ - fix(react-router): (v7) fix static prerender of non-ascii characters ([#12161](https://github.com/remix-run/react-router/pull/12161))
757
+ - Updated dependencies:
758
+ - `react-router@7.0.0`
759
+ - `@react-router/serve@7.0.0`
760
+ - `@react-router/node@7.0.0`
761
+
762
+ ## 2.9.0
763
+
764
+ ### Minor Changes
765
+
766
+ - New `future.unstable_singleFetch` flag ([#8773](https://github.com/remix-run/remix/pull/8773))
767
+ - Naked objects returned from loaders/actions are no longer automatically converted to JSON responses. They'll be streamed as-is via `turbo-stream` so `Date`'s will become `Date` through `useLoaderData()`
768
+ - You can return naked objects with `Promise`'s without needing to use `defer()` - including nested `Promise`'s
769
+ - If you need to return a custom status code or custom response headers, you can still use the `defer` utility
770
+ - `<RemixServer abortDelay>` is no longer used. Instead, you should `export const streamTimeout` from `entry.server.tsx` and the remix server runtime will use that as the delay to abort the streamed response
771
+ - If you export your own streamTimeout, you should decouple that from aborting the react `renderToPipeableStream`. You should always ensure that react is aborted _afer_ the stream is aborted so that abort rejections can be flushed down
772
+ - Actions no longer automatically revalidate on 4xx/5xx responses (via RR `future.unstable_skipActionErrorRevalidation` flag) - you can return a 2xx to opt-into revalidation or use `shouldRevalidate`
773
+
774
+ ### Patch Changes
775
+
776
+ - Improve `getDependenciesToBundle` resolution in monorepos ([#8848](https://github.com/remix-run/remix/pull/8848))
777
+ - Fix SPA mode when single fetch is enabled by using streaming entry.server ([#9063](https://github.com/remix-run/remix/pull/9063))
778
+ - Vite: added sourcemap support for transformed routes ([#8970](https://github.com/remix-run/remix/pull/8970))
779
+ - Update links printed to the console by the Remix CLI/Dev Server to point to updated docs locations ([#9176](https://github.com/remix-run/remix/pull/9176))
780
+ - Updated dependencies:
781
+ - `@remix-run/node@2.9.0`
782
+ - `@remix-run/server-runtime@2.9.0`
783
+
784
+ ## 2.8.1
785
+
786
+ ### Patch Changes
787
+
788
+ - Support reading from Vite config when running `remix reveal` and `remix routes` CLI commands ([#8916](https://github.com/remix-run/remix/pull/8916))
789
+ - Add Vite commands to Remix CLI `--help` output ([#8939](https://github.com/remix-run/remix/pull/8939))
790
+ - Vite: Fix support for `build.sourcemap` option in Vite config ([#8965](https://github.com/remix-run/remix/pull/8965))
791
+ - Clean up redundant client route query strings on route JavaScript files in production builds ([#8969](https://github.com/remix-run/remix/pull/8969))
792
+ - Vite: Fix error when using Vite's `server.fs.allow` option without a client entry file ([#8966](https://github.com/remix-run/remix/pull/8966))
793
+ - Updated dependencies:
794
+ - `@remix-run/node@2.8.1`
795
+ - `@remix-run/server-runtime@2.8.1`
796
+
797
+ ## 2.8.0
798
+
799
+ ### Minor Changes
800
+
801
+ - Pass resolved `viteConfig` to Remix Vite plugin's `buildEnd` hook ([#8885](https://github.com/remix-run/remix/pull/8885))
802
+
803
+ ### Patch Changes
804
+
805
+ - Mark `Layout` as browser safe route export in `esbuild` compiler ([#8842](https://github.com/remix-run/remix/pull/8842))
806
+ - Vite: Silence build warnings when dependencies include "use client" directives ([#8897](https://github.com/remix-run/remix/pull/8897))
807
+ - Vite: Fix `serverBundles` issue where multiple browser manifests are generated ([#8864](https://github.com/remix-run/remix/pull/8864))
808
+ - Support custom Vite `build.assetsDir` option ([#8843](https://github.com/remix-run/remix/pull/8843))
809
+ - Updated dependencies:
810
+ - `@remix-run/node@2.8.0`
811
+ - `@remix-run/server-runtime@2.8.0`
812
+
813
+ ## 2.7.2
814
+
815
+ ### Patch Changes
816
+
817
+ - Vite: Fix error when building projects with `.css?url` imports ([#8829](https://github.com/remix-run/remix/pull/8829))
818
+ - Updated dependencies:
819
+ - `@remix-run/node@2.7.2`
820
+ - `@remix-run/server-runtime@2.7.2`
821
+
822
+ ## 2.7.1
823
+
824
+ ### Patch Changes
825
+
826
+ - Updated dependencies:
827
+ - `@remix-run/node@2.7.1`
828
+ - `@remix-run/server-runtime@2.7.1`
829
+
830
+ ## 2.7.0
831
+
832
+ ### Minor Changes
833
+
834
+ - Allow an optional `Layout` export from the root route ([#8709](https://github.com/remix-run/remix/pull/8709))
835
+
836
+ - Vite: Cloudflare Proxy as a Vite plugin ([#8749](https://github.com/remix-run/remix/pull/8749))
837
+
838
+ **This is a breaking change for projects relying on Cloudflare support from the unstable Vite plugin**
839
+
840
+ The Cloudflare preset (`unstable_cloudflarePreset`) as been removed and replaced with a new Vite plugin:
841
+
842
+ ```diff
843
+ import {
844
+ unstable_vitePlugin as remix,
845
+ - unstable_cloudflarePreset as cloudflare,
846
+ + cloudflareDevProxyVitePlugin as remixCloudflareDevProxy,
847
+ } from "@remix-run/dev";
848
+ import { defineConfig } from "vite";
849
+
850
+ export default defineConfig({
851
+ plugins: [
852
+ + remixCloudflareDevProxy(),
853
+ + remix(),
854
+ - remix({
855
+ - presets: [cloudflare()],
856
+ - }),
857
+ ],
858
+ - ssr: {
859
+ - resolve: {
860
+ - externalConditions: ["workerd", "worker"],
861
+ - },
862
+ - },
863
+ });
864
+ ```
865
+
866
+ `remixCloudflareDevProxy` must come _before_ the `remix` plugin so that it can override Vite's dev server middleware to be compatible with Cloudflare's proxied environment.
867
+
868
+ Because it is a Vite plugin, `remixCloudflareDevProxy` can set `ssr.resolve.externalConditions` to be `workerd`-compatible for you.
869
+
870
+ `remixCloudflareDevProxy` accepts a `getLoadContext` function that replaces the old `getRemixDevLoadContext`.
871
+ If you were using a `nightly` version that required `getBindingsProxy` or `getPlatformProxy`, that is no longer required.
872
+ Any options you were passing to `getBindingsProxy` or `getPlatformProxy` should now be passed to `remixCloudflareDevProxy` instead.
873
+
874
+ This API also better aligns with future plans to support Cloudflare with a framework-agnostic Vite plugin that makes use of Vite's (experimental) Runtime API.
875
+
876
+ - Vite: Stabilize the Remix Vite plugin, Cloudflare preset, and all related types by removing all `unstable_` / `Unstable_` prefixes. ([#8713](https://github.com/remix-run/remix/pull/8713))
877
+
878
+ While this is a breaking change for existing Remix Vite plugin consumers, now that the plugin has stabilized, there will no longer be any breaking changes outside of a major release. Thank you to all of our early adopters and community contributors for helping us get here! 🙏
879
+
880
+ - Vite: Stabilize "SPA Mode" by renaming the Remix vite plugin config from `unstable_ssr -> ssr` ([#8692](https://github.com/remix-run/remix/pull/8692))
881
+
882
+ - Vite: Add a new `basename` option to the Vite plugin, allowing users to set the internal React Router [`basename`](https://reactrouter.com/en/main/routers/create-browser-router#basename) in order to to serve their applications underneath a subpath ([#8145](https://github.com/remix-run/remix/pull/8145))
883
+
884
+ ### Patch Changes
885
+
886
+ - Vite: fix server exports dead-code elimination for routes outside of app directory ([#8795](https://github.com/remix-run/remix/pull/8795))
887
+
888
+ - Always prepend DOCTYPE in SPA mode entry.server.tsx, can opt out via remix reveal ([#8725](https://github.com/remix-run/remix/pull/8725))
889
+
890
+ - Fix build issue in SPA mode when using a `basename` ([#8720](https://github.com/remix-run/remix/pull/8720))
891
+
892
+ - Vite: Validate that the MDX Rollup plugin, if present, is placed before Remix in Vite config ([#8690](https://github.com/remix-run/remix/pull/8690))
893
+
894
+ - Vite: reliably detect non-root routes in Windows ([#8806](https://github.com/remix-run/remix/pull/8806))
895
+
896
+ Sometimes route `file` will be unnormalized Windows path with `\` instead of `/`.
897
+
898
+ - Vite: Pass `remixUserConfig` to preset `remixConfig` hook ([#8797](https://github.com/remix-run/remix/pull/8797))
899
+
900
+ - Vite: Fix issue resolving critical CSS during development when the current working directory differs from the project root ([#8752](https://github.com/remix-run/remix/pull/8752))
901
+
902
+ - Vite: Ensure CSS file URLs that are only referenced in the server build are available on the client ([#8796](https://github.com/remix-run/remix/pull/8796))
903
+
904
+ - Vite: Require version 5.1.0 to support `.css?url` imports ([#8723](https://github.com/remix-run/remix/pull/8723))
905
+
906
+ - Fix type error in Remix config for synchronous `routes` function ([#8745](https://github.com/remix-run/remix/pull/8745))
907
+
908
+ - Vite: Support Vite v5.1.0's `.css?url` imports ([#8684](https://github.com/remix-run/remix/pull/8684))
909
+
910
+ - Always ignore route files starting with `.` ([#8801](https://github.com/remix-run/remix/pull/8801))
911
+
912
+ - Vite: Enable use of [`vite preview`](https://main.vitejs.dev/guide/static-deploy.html#deploying-a-static-site) to preview Remix SPA applications ([#8624](https://github.com/remix-run/remix/pull/8624))
913
+ - In the SPA template, `npm run start` has been renamed to `npm run preview` which uses `vite preview` instead of a standalone HTTP server such as `http-server` or `serv-cli`
914
+
915
+ - Vite: Remove the ability to pass `publicPath` as an option to the Remix vite plugin ([#8145](https://github.com/remix-run/remix/pull/8145))
916
+ - ⚠️ **This is a breaking change for projects using the unstable Vite plugin with a `publicPath`**
917
+ - This is already handled in Vite via the [`base`](https://vitejs.dev/guide/build.html#public-base-path) config so we now set the Remix `publicPath` from the Vite `base` config
918
+
919
+ - Vite: Fix issue where client route file requests fail if search params have been parsed and serialized before reaching the Remix Vite plugin ([#8740](https://github.com/remix-run/remix/pull/8740))
920
+
921
+ - Vite: Enable HMR for .md and .mdx files ([#8711](https://github.com/remix-run/remix/pull/8711))
922
+
923
+ - Updated dependencies:
924
+ - `@remix-run/server-runtime@2.7.0`
925
+ - `@remix-run/node@2.7.0`
926
+
927
+ ## 2.6.0
928
+
929
+ ### Minor Changes
930
+
931
+ - Add `future.v3_throwAbortReason` flag to throw `request.signal.reason` when a request is aborted instead of an `Error` such as `new Error("query() call aborted: GET /path")` ([#8251](https://github.com/remix-run/remix/pull/8251))
932
+
933
+ ### Patch Changes
934
+
935
+ - Vite: Add `manifest` option to Vite plugin to enable writing a `.remix/manifest.json` file to the build directory ([#8575](https://github.com/remix-run/remix/pull/8575))
936
+
937
+ **This is a breaking change for consumers of the Vite plugin's "server bundles" feature.**
938
+
939
+ The `build/server/bundles.json` file has been superseded by the more general `build/.remix/manifest.json`. While the old server bundles manifest was always written to disk when generating server bundles, the build manifest file must be explicitly enabled via the `manifest` option.
940
+
941
+ - Vite: Provide `Unstable_ServerBundlesFunction` and `Unstable_VitePluginConfig` types ([#8654](https://github.com/remix-run/remix/pull/8654))
942
+
943
+ - Vite: add `--sourcemapClient` and `--sourcemapServer` flags to `remix vite:build` ([#8613](https://github.com/remix-run/remix/pull/8613))
944
+ - `--sourcemapClient`
945
+
946
+ - `--sourcemapClient=inline`
947
+
948
+ - `--sourcemapClient=hidden`
949
+
950
+ - `--sourcemapServer`
951
+
952
+ - `--sourcemapServer=inline`
953
+
954
+ - `--sourcemapServer=hidden`
955
+
956
+ See <https://vitejs.dev/config/build-options.html#build-sourcemap>
957
+
958
+ - Vite: Validate IDs returned from the `serverBundles` function to ensure they only contain alphanumeric characters, hyphens and underscores ([#8598](https://github.com/remix-run/remix/pull/8598))
959
+
960
+ - Vite: fix "could not fast refresh" false alarm ([#8580](https://github.com/remix-run/remix/pull/8580))
961
+
962
+ HMR is already functioning correctly but was incorrectly logging that it "could not fast refresh" on internal client routes.
963
+ Now internal client routes correctly register Remix exports like `meta` for fast refresh,
964
+ which removes the false alarm.
965
+
966
+ - Vite: Cloudflare Pages support ([#8531](https://github.com/remix-run/remix/pull/8531))
967
+
968
+ To get started with Cloudflare, you can use the \[`unstable-vite-cloudflare`]\[template-vite-cloudflare] template:
969
+
970
+ ```shellscript nonumber
971
+ npx create-remix@latest --template remix-run/remix/templates/unstable-vite-cloudflare
972
+ ```
973
+
974
+ Or read the new docs at [Future > Vite > Cloudflare](https://remix.run/docs/en/main/future/vite#cloudflare) and
975
+ [Future > Vite > Migrating > Migrating Cloudflare Functions](https://remix.run/docs/en/main/future/vite#migrating-cloudflare-functions).
976
+
977
+ - Vite: Remove undocumented backwards compatibility layer for Vite v4 ([#8581](https://github.com/remix-run/remix/pull/8581))
978
+
979
+ - Vite: rely on Vite plugin ordering ([#8627](https://github.com/remix-run/remix/pull/8627))
980
+
981
+ **This is a breaking change for projects using the unstable Vite plugin.**
982
+
983
+ The Remix plugin expects to process JavaScript or TypeScript files, so any transpilation from other languages must be done first.
984
+ For example, that means putting the MDX plugin _before_ the Remix plugin:
985
+
986
+ ```diff
987
+ import mdx from "@mdx-js/rollup";
988
+ import { unstable_vitePlugin as remix } from "@remix-run/dev";
989
+ import { defineConfig } from "vite";
990
+
991
+ export default defineConfig({
992
+ plugins: [
993
+ + mdx(),
994
+ remix()
995
+ - mdx(),
996
+ ],
997
+ });
998
+ ```
999
+
1000
+ Previously, the Remix plugin misused `enforce: "post"` from Vite's plugin API to ensure that it ran last.
1001
+ However, this caused other unforeseen issues.
1002
+ Instead, we now rely on standard Vite semantics for plugin ordering.
1003
+
1004
+ The official [Vite React SWC plugin](https://github.com/vitejs/vite-plugin-react-swc/blob/main/src/index.ts#L97-L116) also relies on plugin ordering for MDX.
1005
+
1006
+ - Vite: Add `presets` option to ease integration with different platforms and tools. ([#8514](https://github.com/remix-run/remix/pull/8514))
1007
+
1008
+ - Vite: Remove interop with `<LiveReload />`, rely on `<Scripts />` instead ([#8636](https://github.com/remix-run/remix/pull/8636))
1009
+
1010
+ **This is a breaking change for projects using the unstable Vite plugin.**
1011
+
1012
+ Vite provides a robust client-side runtime for development features like HMR,
1013
+ making the `<LiveReload />` component obsolete.
1014
+
1015
+ In fact, having a separate dev scripts component was causing issues with script execution order.
1016
+ To work around this, the Remix Vite plugin used to override `<LiveReload />` into a bespoke
1017
+ implementation that was compatible with Vite.
1018
+
1019
+ Instead of all this indirection, now the Remix Vite plugin instructs the `<Scripts />` component
1020
+ to automatically include Vite's client-side runtime and other dev-only scripts.
1021
+
1022
+ ```diff
1023
+ import {
1024
+ - LiveReload,
1025
+ Outlet,
1026
+ Scripts,
1027
+ }
1028
+
1029
+ export default function App() {
1030
+ return (
1031
+ <html>
1032
+ <head>
1033
+ </head>
1034
+ <body>
1035
+ <Outlet />
1036
+ <Scripts />
1037
+ - <LiveReload />
1038
+ </body>
1039
+ </html>
1040
+ )
1041
+ }
1042
+ ```
1043
+
1044
+ - Vite: Add `buildEnd` hook ([#8620](https://github.com/remix-run/remix/pull/8620))
1045
+
1046
+ - Vite: add dev load context option to Cloudflare preset ([#8649](https://github.com/remix-run/remix/pull/8649))
1047
+
1048
+ - Vite: Add `mode` field into generated server build ([#8539](https://github.com/remix-run/remix/pull/8539))
1049
+
1050
+ - Vite: Only write Vite manifest files if `build.manifest` is enabled within the Vite config ([#8599](https://github.com/remix-run/remix/pull/8599))
1051
+
1052
+ **This is a breaking change for consumers of Vite's `manifest.json` files.**
1053
+
1054
+ To explicitly enable generation of Vite manifest files, you must set `build.manifest` to `true` in your Vite config.
1055
+
1056
+ ```ts
1057
+ export default defineConfig({
1058
+ build: { manifest: true },
1059
+ // ...
1060
+ });
1061
+ ```
1062
+
1063
+ - Vite: reduce network calls for route modules during HMR ([#8591](https://github.com/remix-run/remix/pull/8591))
1064
+
1065
+ - Vite: Add new `buildDirectory` option with a default value of `"build"`. This replaces the old `assetsBuildDirectory` and `serverBuildDirectory` options which defaulted to `"build/client"` and `"build/server"` respectively. ([#8575](https://github.com/remix-run/remix/pull/8575))
1066
+
1067
+ **This is a breaking change for consumers of the Vite plugin that were using the `assetsBuildDirectory` and `serverBuildDirectory` options.**
1068
+
1069
+ The Remix Vite plugin now builds into a single directory containing `client` and `server` directories. If you've customized your build output directories, you'll need to migrate to the new `buildDirectory` option, e.g.
1070
+
1071
+ ```diff
1072
+ import { unstable_vitePlugin as remix } from "@remix-run/dev";
1073
+ import { defineConfig } from "vite";
1074
+
1075
+ export default defineConfig({
1076
+ plugins: [
1077
+ remix({
1078
+ - serverBuildDirectory: "dist/server",
1079
+ - assetsBuildDirectory: "dist/client",
1080
+ + buildDirectory: "dist",
1081
+ })
1082
+ ],
1083
+ });
1084
+ ```
1085
+
1086
+ - Vite: Remove `unstable` prefix from `serverBundles` option. ([#8596](https://github.com/remix-run/remix/pull/8596))
1087
+
1088
+ - Vite: Write Vite manifest files to `build/.vite` directory rather than being nested within `build/client` and `build/server` directories. ([#8599](https://github.com/remix-run/remix/pull/8599))
1089
+
1090
+ **This is a breaking change for consumers of Vite's `manifest.json` files.**
1091
+
1092
+ Vite manifest files are now written to the Remix build directory. Since all Vite manifests are now in the same directory, they're no longer named `manifest.json`. Instead, they're named `build/.vite/client-manifest.json` and `build/.vite/server-manifest.json`, or `build/.vite/server-{BUNDLE_ID}-manifest.json` when using server bundles.
1093
+
1094
+ - Updated dependencies:
1095
+ - `@remix-run/server-runtime@2.6.0`
1096
+ - `@remix-run/node@2.6.0`
1097
+
1098
+ ## 2.5.1
1099
+
1100
+ ### Patch Changes
1101
+
1102
+ - Add `isSpaMode` to `@remix-run/dev/server-build` virtual module ([#8492](https://github.com/remix-run/remix/pull/8492))
1103
+ - Automatically prepend `<!DOCTYPE html>` if not present to fix quirks mode warnings for SPA template ([#8495](https://github.com/remix-run/remix/pull/8495))
1104
+ - Vite: Errors for server-only code point to new docs ([#8488](https://github.com/remix-run/remix/pull/8488))
1105
+ - Vite: Fix HMR race condition when reading changed file contents ([#8479](https://github.com/remix-run/remix/pull/8479))
1106
+ - Vite: Tree-shake unused route exports in the client build ([#8468](https://github.com/remix-run/remix/pull/8468))
1107
+ - Vite: Performance profiling ([#8493](https://github.com/remix-run/remix/pull/8493))
1108
+ - Run `remix vite:build --profile` to generate a `.cpuprofile` that can be shared or uploaded to speedscope.app
1109
+ - In dev, press `p + enter` to start a new profiling session or stop the current session
1110
+ - If you need to profile dev server startup, run `remix vite:dev --profile` to initialize the dev server with a running profiling session
1111
+ - For more, see the new docs: Vite > Performance
1112
+ - Vite: Improve performance of dev server requests by invalidating Remix's virtual modules on relevant file changes rather than on every request ([#8164](https://github.com/remix-run/remix/pull/8164))
1113
+ - Updated dependencies:
1114
+ - `@remix-run/node@2.5.1`
1115
+ - `@remix-run/server-runtime@2.5.1`
1116
+
1117
+ ## 2.5.0
1118
+
1119
+ ### Minor Changes
1120
+
1121
+ - Add unstable support for "SPA Mode" ([#8457](https://github.com/remix-run/remix/pull/8457))
1122
+
1123
+ You can opt into SPA Mode by setting `unstable_ssr: false` in your Remix Vite plugin config:
1124
+
1125
+ ```js
1126
+ // vite.config.ts
1127
+ import { unstable_vitePlugin as remix } from "@remix-run/dev";
1128
+ import { defineConfig } from "vite";
1129
+
1130
+ export default defineConfig({
1131
+ plugins: [remix({ unstable_ssr: false })],
1132
+ });
1133
+ ```
1134
+
1135
+ Development in SPA Mode is just like a normal Remix app, and still uses the Remix dev server for HMR/HDR:
1136
+
1137
+ ```sh
1138
+ remix vite:dev
1139
+ ```
1140
+
1141
+ Building in SPA Mode will generate an `index.html` file in your client assets directory:
1142
+
1143
+ ```sh
1144
+ remix vite:build
1145
+ ```
1146
+
1147
+ To run your SPA, you serve your client assets directory via an HTTP server:
1148
+
1149
+ ```sh
1150
+ npx http-server build/client
1151
+ ```
1152
+
1153
+ For more information, please refer to the [SPA Mode docs](https://remix.run/future/spa-mode).
1154
+
1155
+ - Add `unstable_serverBundles` option to Vite plugin to support splitting server code into multiple request handlers. ([#8332](https://github.com/remix-run/remix/pull/8332))
1156
+
1157
+ This is an advanced feature designed for hosting provider integrations. When compiling your app into multiple server bundles, there will need to be a custom routing layer in front of your app directing requests to the correct bundle. This feature is currently unstable and only designed to gather early feedback.
1158
+
1159
+ **Example usage:**
1160
+
1161
+ ```ts
1162
+ import { unstable_vitePlugin as remix } from "@remix-run/dev";
1163
+ import { defineConfig } from "vite";
1164
+
1165
+ export default defineConfig({
1166
+ plugins: [
1167
+ remix({
1168
+ unstable_serverBundles: ({ branch }) => {
1169
+ const isAuthenticatedRoute = branch.some(
1170
+ (route) => route.id === "routes/_authenticated",
1171
+ );
1172
+
1173
+ return isAuthenticatedRoute ? "authenticated" : "unauthenticated";
1174
+ },
1175
+ }),
1176
+ ],
1177
+ });
1178
+ ```
1179
+
1180
+ ### Patch Changes
1181
+
1182
+ - Fix issue with `isbot` v4 released on 1/1/2024 ([#8415](https://github.com/remix-run/remix/pull/8415))
1183
+ - `remix dev` will now add `"isbot": "^4"` to `package.json` instead of using `latest`
1184
+ - Update built-in `entry.server` files to work with both `isbot@3` and `isbot@4` for backwards-compatibility with Remix apps that have pinned `isbot` to v3
1185
+ - Templates are updated to use `isbot@4` moving forward via `create-remix`
1186
+
1187
+ - Vite: Fix HMR issues when altering exports for non-rendered routes ([#8157](https://github.com/remix-run/remix/pull/8157))
1188
+
1189
+ - Vite: Default `NODE_ENV` to `"production"` when running `remix vite:build` command ([#8405](https://github.com/remix-run/remix/pull/8405))
1190
+
1191
+ - Vite: Remove Vite plugin config option `serverBuildPath` in favor of separate `serverBuildDirectory` and `serverBuildFile` options ([#8332](https://github.com/remix-run/remix/pull/8332))
1192
+
1193
+ - Vite: Loosen strict route exports restriction, reinstating support for non-Remix route exports ([#8420](https://github.com/remix-run/remix/pull/8420))
1194
+
1195
+ - Updated dependencies:
1196
+ - `@remix-run/server-runtime@2.5.0`
1197
+ - `@remix-run/node@2.5.0`
1198
+
1199
+ ## 2.4.1
1200
+
1201
+ ### Patch Changes
1202
+
1203
+ - Vite: Error messages when `.server` files are referenced by client ([#8267](https://github.com/remix-run/remix/pull/8267))
1204
+ - Previously, referencing a `.server` module from client code resulted in an error message like:
1205
+ - `The requested module '/app/models/answer.server.ts' does not provide an export named 'isDateType'`
1206
+ - This was confusing because `answer.server.ts` _does_ provide the `isDateType` export, but Remix was replacing `.server` modules with empty modules (`export {}`) for the client build
1207
+ - Now, Remix explicitly fails at compile time when a `.server` module is referenced from client code and includes dedicated error messages depending on whether the import occurs in a route or a non-route module
1208
+ - The error messages also include links to relevant documentation
1209
+
1210
+ - Remove `unstable_viteServerBuildModuleId` in favor of manually referencing virtual module name `"virtual:remix/server-build"`. ([#8264](https://github.com/remix-run/remix/pull/8264))
1211
+
1212
+ **This is a breaking change for projects using the unstable Vite plugin with a custom server.**
1213
+
1214
+ This change was made to avoid issues where `@remix-run/dev` could be inadvertently required in your server's production dependencies.
1215
+
1216
+ Instead, you should manually write the virtual module name `"virtual:remix/server-build"` when calling `ssrLoadModule` in development.
1217
+
1218
+ ```diff
1219
+ -import { unstable_viteServerBuildModuleId } from "@remix-run/dev";
1220
+
1221
+ // ...
1222
+
1223
+ app.all(
1224
+ "*",
1225
+ createRequestHandler({
1226
+ build: vite
1227
+ - ? () => vite.ssrLoadModule(unstable_viteServerBuildModuleId)
1228
+ + ? () => vite.ssrLoadModule("virtual:remix/server-build")
1229
+ : await import("./build/server/index.js"),
1230
+ })
1231
+ );
1232
+ ```
1233
+
1234
+ - Vite: Fix errors for non-existent `index.html` importer ([#8353](https://github.com/remix-run/remix/pull/8353))
1235
+
1236
+ - Add `vite:dev` and `vite:build` commands to the Remix CLI. ([#8211](https://github.com/remix-run/remix/pull/8211))
1237
+
1238
+ In order to handle upcoming Remix features where your plugin options can impact the number of Vite builds required, you should now run your Vite `dev` and `build` processes via the Remix CLI.
1239
+
1240
+ ```diff
1241
+ {
1242
+ "scripts": {
1243
+ - "dev": "vite dev",
1244
+ - "build": "vite build && vite build --ssr"
1245
+ + "dev": "remix vite:dev",
1246
+ + "build": "remix vite:build"
1247
+ }
1248
+ }
1249
+ ```
1250
+
1251
+ - Vite: Preserve names for exports from `.client` modules ([#8200](https://github.com/remix-run/remix/pull/8200))
1252
+
1253
+ Unlike `.server` modules, the main idea is not to prevent code from leaking into the server build
1254
+ since the client build is already public. Rather, the goal is to isolate the SSR render from client-only code.
1255
+ Routes need to import code from `.client` modules without compilation failing and then rely on runtime checks
1256
+ or otherwise ensure that execution only happens within a client-only context (e.g. event handlers, `useEffect`).
1257
+
1258
+ Replacing `.client` modules with empty modules would cause the build to fail as ESM named imports are statically analyzed.
1259
+ So instead, we preserve the named export but replace each exported value with `undefined`.
1260
+ That way, the import is valid at build time and standard runtime checks can be used to determine if the
1261
+ code is running on the server or client.
1262
+
1263
+ - Disable watch mode in Vite child compiler during build ([#8342](https://github.com/remix-run/remix/pull/8342))
1264
+
1265
+ - Vite: Show warning when source maps are enabled in production build ([#8222](https://github.com/remix-run/remix/pull/8222))
1266
+
1267
+ - Updated dependencies:
1268
+ - `@remix-run/server-runtime@2.4.1`
1269
+ - `@remix-run/node@2.4.1`
1270
+
1271
+ ## 2.4.0
1272
+
1273
+ ### Minor Changes
1274
+
1275
+ - Vite: exclude modules within `.server` directories from client build ([#8154](https://github.com/remix-run/remix/pull/8154))
1276
+
1277
+ - Add support for `clientLoader`/`clientAction`/`HydrateFallback` route exports ([RFC](https://github.com/remix-run/remix/discussions/7634)) ([#8173](https://github.com/remix-run/remix/pull/8173))
1278
+
1279
+ Remix now supports loaders/actions that run on the client (in addition to, or instead of the loader/action that runs on the server). While we still recommend server loaders/actions for the majority of your data needs in a Remix app - these provide some levers you can pull for more advanced use-cases such as:
1280
+ - Leveraging a data source local to the browser (i.e., `localStorage`)
1281
+ - Managing a client-side cache of server data (like `IndexedDB`)
1282
+ - Bypassing the Remix server in a BFF setup and hitting your API directly from the browser
1283
+ - Migrating a React Router SPA to a Remix application
1284
+
1285
+ By default, `clientLoader` will not run on hydration, and will only run on subsequent client side navigations.
1286
+
1287
+ If you wish to run your client loader on hydration, you can set `clientLoader.hydrate=true` to force Remix to execute it on initial page load. Keep in mind that Remix will still SSR your route component so you should ensure that there is no new _required_ data being added by your `clientLoader`.
1288
+
1289
+ If your `clientLoader` needs to run on hydration and adds data you require to render the route component, you can export a `HydrateFallback` component that will render during SSR, and then your route component will not render until the `clientLoader` has executed on hydration.
1290
+
1291
+ `clientAction` is simpler than `clientLoader` because it has no hydration use-cases. `clientAction` will only run on client-side navigations.
1292
+
1293
+ For more information, please refer to the [`clientLoader`](https://remix.run/route/client-loader) and [`clientAction`](https://remix.run/route/client-action) documentation.
1294
+
1295
+ - Vite: Strict route exports ([#8171](https://github.com/remix-run/remix/pull/8171))
1296
+
1297
+ With Vite, Remix gets stricter about which exports are allowed from your route modules.
1298
+ Previously, the Remix compiler would allow any export from routes.
1299
+ While this was convenient, it was also a common source of bugs that were hard to track down because they only surfaced at runtime.
1300
+
1301
+ For more, see <https://remix.run/docs/en/main/future/vite#strict-route-exports>
1302
+
1303
+ - Add a new `future.v3_relativeSplatPath` flag to implement a breaking bug fix to relative routing when inside a splat route. For more information, please see the React Router [`6.21.0` Release Notes](https://github.com/remix-run/react-router/blob/release-next/CHANGELOG.md#futurev7_relativesplatpath) and the [`useResolvedPath` docs](https://remix.run/hooks/use-resolved-path#splat-paths). ([#8216](https://github.com/remix-run/remix/pull/8216))
1304
+
1305
+ ### Patch Changes
1306
+
1307
+ - Upgrade Vite peer dependency range to v5 ([#8172](https://github.com/remix-run/remix/pull/8172))
1308
+
1309
+ - Support HMR for routes with `handle` export in Vite dev ([#8022](https://github.com/remix-run/remix/pull/8022))
1310
+
1311
+ - Fix flash of unstyled content for non-Express custom servers in Vite dev ([#8076](https://github.com/remix-run/remix/pull/8076))
1312
+
1313
+ - Bundle CSS imported in client entry file in Vite plugin ([#8143](https://github.com/remix-run/remix/pull/8143))
1314
+
1315
+ - Change Vite build output paths to fix a conflict between how Vite and the Remix compiler each manage the `public` directory. ([#8077](https://github.com/remix-run/remix/pull/8077))
1316
+
1317
+ **This is a breaking change for projects using the unstable Vite plugin.**
1318
+
1319
+ The server is now compiled into `build/server` rather than `build`, and the client is now compiled into `build/client` rather than `public`.
1320
+
1321
+ For more information on the changes and guidance on how to migrate your project, refer to the updated [Remix Vite documentation](https://remix.run/docs/en/main/future/vite).
1322
+
1323
+ - Remove undocumented `legacyCssImports` option from Vite plugin due to issues with `?url` imports of CSS files not being processed correctly in Vite ([#8096](https://github.com/remix-run/remix/pull/8096))
1324
+
1325
+ - Vite: fix access to default `entry.{client,server}.tsx` within pnpm workspace on Windows ([#8057](https://github.com/remix-run/remix/pull/8057))
1326
+
1327
+ - Remove `unstable_createViteServer` and `unstable_loadViteServerBuild` which were only minimal wrappers around Vite's `createServer` and `ssrLoadModule` functions when using a custom server. ([#8120](https://github.com/remix-run/remix/pull/8120))
1328
+
1329
+ **This is a breaking change for projects using the unstable Vite plugin with a custom server.**
1330
+
1331
+ Instead, we now provide `unstable_viteServerBuildModuleId` so that custom servers interact with Vite directly rather than via Remix APIs, for example:
1332
+
1333
+ ```diff
1334
+ -import {
1335
+ - unstable_createViteServer,
1336
+ - unstable_loadViteServerBuild,
1337
+ -} from "@remix-run/dev";
1338
+ +import { unstable_viteServerBuildModuleId } from "@remix-run/dev";
1339
+ ```
1340
+
1341
+ Creating the Vite server in middleware mode:
1342
+
1343
+ ```diff
1344
+ const vite =
1345
+ process.env.NODE_ENV === "production"
1346
+ ? undefined
1347
+ - : await unstable_createViteServer();
1348
+ + : await import("vite").then(({ createServer }) =>
1349
+ + createServer({
1350
+ + server: {
1351
+ + middlewareMode: true,
1352
+ + },
1353
+ + })
1354
+ + );
1355
+ ```
1356
+
1357
+ Loading the Vite server build in the request handler:
1358
+
1359
+ ```diff
1360
+ app.all(
1361
+ "*",
1362
+ createRequestHandler({
1363
+ build: vite
1364
+ - ? () => unstable_loadViteServerBuild(vite)
1365
+ + ? () => vite.ssrLoadModule(unstable_viteServerBuildModuleId)
1366
+ : await import("./build/server/index.js"),
1367
+ })
1368
+ );
1369
+ ```
1370
+
1371
+ - Pass request handler errors to `vite.ssrFixStacktrace` in Vite dev to ensure stack traces correctly map to the original source code ([#8066](https://github.com/remix-run/remix/pull/8066))
1372
+
1373
+ - Vite: Preserve names for exports from .client imports ([#8200](https://github.com/remix-run/remix/pull/8200))
1374
+
1375
+ Unlike `.server` modules, the main idea is not to prevent code from leaking into the server build
1376
+ since the client build is already public. Rather, the goal is to isolate the SSR render from client-only code.
1377
+ Routes need to import code from `.client` modules without compilation failing and then rely on runtime checks
1378
+ to determine if the code is running on the server or client.
1379
+
1380
+ Replacing `.client` modules with empty modules would cause the build to fail as ESM named imports are statically analyzed.
1381
+ So instead, we preserve the named export but replace each exported value with an empty object.
1382
+ That way, the import is valid at build time and the standard runtime checks can be used to determine if then
1383
+ code is running on the server or client.
1384
+
1385
+ - Add `@remix-run/node` to Vite's `optimizeDeps.include` array ([#8177](https://github.com/remix-run/remix/pull/8177))
1386
+
1387
+ - Improve Vite plugin performance ([#8121](https://github.com/remix-run/remix/pull/8121))
1388
+ - Parallelize detection of route module exports
1389
+ - Disable `server.preTransformRequests` in Vite child compiler since it's only used to process route modules
1390
+
1391
+ - Remove automatic global Node polyfill installation from the built-in Vite dev server and instead allow explicit opt-in. ([#8119](https://github.com/remix-run/remix/pull/8119))
1392
+
1393
+ **This is a breaking change for projects using the unstable Vite plugin without a custom server.**
1394
+
1395
+ If you're not using a custom server, you should call `installGlobals` in your Vite config instead.
1396
+
1397
+ ```diff
1398
+ import { unstable_vitePlugin as remix } from "@remix-run/dev";
1399
+ +import { installGlobals } from "@remix-run/node";
1400
+ import { defineConfig } from "vite";
1401
+
1402
+ +installGlobals();
1403
+
1404
+ export default defineConfig({
1405
+ plugins: [remix()],
1406
+ });
1407
+ ```
1408
+
1409
+ - Vite: Errors at build-time when client imports .server default export ([#8184](https://github.com/remix-run/remix/pull/8184))
1410
+
1411
+ Remix already stripped .server file code before ensuring that server code never makes it into the client.
1412
+ That results in errors when client code tries to import server code, which is exactly what we want!
1413
+ But those errors were happening at runtime for default imports.
1414
+ A better experience is to have those errors happen at build-time so that you guarantee that your users won't hit them.
1415
+
1416
+ - Fix `request instanceof Request` checks when using Vite dev server ([#8062](https://github.com/remix-run/remix/pull/8062))
1417
+
1418
+ - Updated dependencies:
1419
+ - `@remix-run/server-runtime@2.4.0`
1420
+ - `@remix-run/node@2.4.0`
1421
+
1422
+ ## 2.3.1
1423
+
1424
+ ### Patch Changes
1425
+
1426
+ - Support `nonce` prop on `LiveReload` component in Vite dev ([#8014](https://github.com/remix-run/remix/pull/8014))
1427
+ - Ensure code-split JS files in the server build's assets directory aren't cleaned up after Vite build ([#8042](https://github.com/remix-run/remix/pull/8042))
1428
+ - Fix redundant copying of assets from `public` directory in Vite build ([#8039](https://github.com/remix-run/remix/pull/8039))
1429
+ - This ensures that static assets aren't duplicated in the server build directory
1430
+ - This also fixes an issue where the build would break if `assetsBuildDirectory` was deeply nested within the `public` directory
1431
+ - Updated dependencies:
1432
+ - `@remix-run/node@2.3.1`
1433
+ - `@remix-run/server-runtime@2.3.1`
1434
+
1435
+ ## 2.3.0
1436
+
1437
+ ### Patch Changes
1438
+
1439
+ - Support rendering of `LiveReload` component after `Scripts` in Vite dev ([#7919](https://github.com/remix-run/remix/pull/7919))
1440
+ - fix(vite): fix "react-refresh/babel" resolution for custom server with pnpm ([#7904](https://github.com/remix-run/remix/pull/7904))
1441
+ - Support JSX usage in `.jsx` files without manual `React` import in Vite ([#7888](https://github.com/remix-run/remix/pull/7888))
1442
+ - Support optional rendering of `LiveReload` component in Vite dev ([#7919](https://github.com/remix-run/remix/pull/7919))
1443
+ - Fix Vite production builds when plugins that have different local state between `development` and `production` modes are present, e.g. `@mdx-js/rollup`. ([#7911](https://github.com/remix-run/remix/pull/7911))
1444
+ - Cache resolution of Remix Vite plugin options ([#7908](https://github.com/remix-run/remix/pull/7908))
1445
+ - Support Vite 5 ([#7846](https://github.com/remix-run/remix/pull/7846))
1446
+ - Allow `process.env.NODE_ENV` values other than `"development"` in Vite dev ([#7980](https://github.com/remix-run/remix/pull/7980))
1447
+ - Attach CSS from shared chunks to routes in Vite build ([#7952](https://github.com/remix-run/remix/pull/7952))
1448
+ - fix(vite): Let Vite handle serving files outside of project root via `/@fs` ([#7913](https://github.com/remix-run/remix/pull/7913))
1449
+ - This fixes errors when using default client entry or server entry in a pnpm project where those files may be outside of the project root, but within the workspace root.
1450
+ - By default, Vite prevents access to files outside the workspace root (when using workspaces) or outside of the project root (when not using workspaces) unless user explicitly opts into it via Vite's `server.fs.allow`.
1451
+ - Improve performance of LiveReload proxy in Vite dev ([#7883](https://github.com/remix-run/remix/pull/7883))
1452
+ - fix(vite): deduplicate `@remix-run/react` ([#7926](https://github.com/remix-run/remix/pull/7926))
1453
+ - Pre-bundle Remix dependencies to avoid Remix router duplicates.
1454
+ - Our remix-react-proxy plugin does not process default client and
1455
+ - server entry files since those come from within `node_modules`.
1456
+ - That means that before Vite pre-bundles dependencies (e.g. first time dev server is run) mismatching Remix routers cause `Error: You must render this element inside a <Remix> element`.
1457
+ - Fix React Fast Refresh error on load when using `defer` in Vite dev server ([#7842](https://github.com/remix-run/remix/pull/7842))
1458
+ - Handle multiple "Set-Cookie" headers in Vite dev server ([#7843](https://github.com/remix-run/remix/pull/7843))
1459
+ - Fix flash of unstyled content on initial page load in Vite dev when using a custom Express server ([#7937](https://github.com/remix-run/remix/pull/7937))
1460
+ - Emit assets that were only referenced in the server build into the client assets directory in Vite build ([#7892](https://github.com/remix-run/remix/pull/7892), cherry-picked in [`8cd31d65`](https://github.com/remix-run/remix/commit/8cd31d6543ef4c765220fc64dca9bcc9c61ee9eb))
1461
+ - Populate `process.env` from `.env` files on the server in Vite dev ([#7958](https://github.com/remix-run/remix/pull/7958))
1462
+ - Fix `FutureConfig` type ([#7895](https://github.com/remix-run/remix/pull/7895))
1463
+ - Updated dependencies:
1464
+ - `@remix-run/server-runtime@2.3.0`
1465
+ - `@remix-run/node@2.3.0`
1466
+
1467
+ ## 2.2.0
1468
+
1469
+ ### Minor Changes
1470
+
1471
+ - Unstable Vite support for Node-based Remix apps ([#7590](https://github.com/remix-run/remix/pull/7590))
1472
+ - `remix build` 👉 `vite build && vite build --ssr`
1473
+ - `remix dev` 👉 `vite dev`
1474
+ - Other runtimes (e.g. Deno, Cloudflare) not yet supported.
1475
+ - See "Future > Vite" in the Remix Docs for details
1476
+ - Add a new `future.v3_fetcherPersist` flag to change the persistence behavior of fetchers. Instead of being immediately cleaned up when unmounted in the UI, fetchers will persist until they return to an `idle` state ([RFC](https://github.com/remix-run/remix/discussions/7698)) ([#7704](https://github.com/remix-run/remix/pull/7704))
1477
+ - For more details, please refer to the [React Router 6.18.0](https://github.com/remix-run/react-router/releases/tag/react-router%406.18.0) release notes
1478
+
1479
+ ### Patch Changes
1480
+
1481
+ - Updated dependencies:
1482
+ - `@remix-run/server-runtime@2.2.0`
1483
+ - `@remix-run/node@2.2.0`
1484
+
1485
+ ## 2.1.0
1486
+
1487
+ ### Patch Changes
1488
+
1489
+ - Sourcemap takes into account special chars in output file ([#7574](https://github.com/remix-run/remix/pull/7574))
1490
+ - Updated dependencies:
1491
+ - `@remix-run/server-runtime@2.1.0`
1492
+
1493
+ ## 2.0.1
1494
+
1495
+ ### Patch Changes
1496
+
1497
+ - Fix types for MDX files when using pnpm ([#7491](https://github.com/remix-run/remix/pull/7491))
1498
+ - Update `getDependenciesToBundle` to handle ESM packages without main exports ([#7272](https://github.com/remix-run/remix/pull/7272))
1499
+ - Note that these packages must expose `package.json` in their `exports` field so that their path can be resolved
1500
+ - Fix server builds where `serverBuildPath` extension is `.cjs` ([#7180](https://github.com/remix-run/remix/pull/7180))
1501
+ - Updated dependencies:
1502
+ - `@remix-run/server-runtime@2.0.1`
1503
+
1504
+ ## 2.0.0
1505
+
1506
+ ### Major Changes
1507
+
1508
+ - The `create-remix` CLI has been rewritten to feature a cleaner interface, Git repo initialization and optional `remix.init` script execution. The interactive template prompt and official Remix stack/template shorthands have also been removed so that community/third-party templates are now on a more equal footing. ([#6887](https://github.com/remix-run/remix/pull/6887))
1509
+ - The code for `create-remix` has been moved out of the Remix CLI since it's not intended for use within an existing Remix application
1510
+ - This means that the `remix create` command is no longer available.
1511
+ - Enable built-in PostCSS and Tailwind support by default. ([#6909](https://github.com/remix-run/remix/pull/6909))
1512
+ - These tools are now automatically used within the Remix compiler if PostCSS and/or Tailwind configuration files are present in your project.
1513
+ - If you have a custom PostCSS and/or Tailwind setup outside of Remix, you can disable these features in your `remix.config.js` via the `postcss:false` and/or `tailwind:false` flags
1514
+ - Drop React 17 support ([#7121](https://github.com/remix-run/remix/pull/7121))
1515
+ - Require Node >=18.0.0 ([#6939](https://github.com/remix-run/remix/pull/6939))
1516
+ - Compile server build to Node 18 ([#7292](https://github.com/remix-run/remix/pull/7292))
1517
+ - This allows features like top-level `await` to be used within a Remix app
1518
+ - Remove default Node.js polyfills - you must now opt-into polyfills via the [`serverNodeBuiltinsPolyfill`](https://remix.run/docs/en/2.0.0/start/v2#servernodebuiltinspolyfill) and [`browserNodeBuiltinsPolyfill`](https://remix.run/docs/en/2.0.0/start/v2#browsernodebuiltinspolyfill) configs ([#7269](https://github.com/remix-run/remix/pull/7269))
1519
+ - Remove `v2_errorBoundary` flag and `CatchBoundary` implementation ([#6906](https://github.com/remix-run/remix/pull/6906))
1520
+ - Remove `v2_normalizeFormMethod` future flag - all `formMethod` values will be normalized in v2 ([#6875](https://github.com/remix-run/remix/pull/6875))
1521
+ - Remove `v2_routeConvention` flag - the flat route file convention is now standard ([#6969](https://github.com/remix-run/remix/pull/6969))
1522
+ - Remove `v2_headers` flag - it is now the default behavior to use the deepest `headers` function in the route tree ([#6979](https://github.com/remix-run/remix/pull/6979))
1523
+ - The route `meta` API now defaults to the new "V2 Meta" API ([#6958](https://github.com/remix-run/remix/pull/6958))
1524
+ - Please refer to the ([docs](https://remix.run/docs/en/2.0.0/route/meta) and [Preparing for V2](https://remix.run/docs/en/2.0.0/start/v2#route-meta) guide for more information.
1525
+ - Default to `serverModuleFormat: "esm"` and update `remix-serve` to use dynamic import to support ESM and CJS build outputs ([#6949](https://github.com/remix-run/remix/pull/6949))
1526
+ - Remove `serverBuildTarget` config option ([#6896](https://github.com/remix-run/remix/pull/6896))
1527
+ - Remove deprecated `REMIX_DEV_HTTP_ORIGIN` env var - use `REMIX_DEV_ORIGIN` instead ([#6963](https://github.com/remix-run/remix/pull/6963))
1528
+ - Remove `devServerBroadcastDelay` config option ([#7063](https://github.com/remix-run/remix/pull/7063))
1529
+ - Remove deprecated `devServerPort` option - use `--port` / `dev.port` instead ([#7078](https://github.com/remix-run/remix/pull/7078))
1530
+ - Remove deprecated `REMIX_DEV_SERVER_WS_PORT` env var - use `remix dev`'s '`--port` / `port` option instead ([#6965](https://github.com/remix-run/remix/pull/6965))
1531
+ - Stop passing `isTypeScript` to `remix.init` script ([#7099](https://github.com/remix-run/remix/pull/7099))
1532
+ - Remove `replace-remix-magic-imports` codemod ([#6899](https://github.com/remix-run/remix/pull/6899))
1533
+ - Remove deprecated `--no-restart`/`restart` cli args/flags - use `--manual`/`manual` instead ([#6962](https://github.com/remix-run/remix/pull/6962))
1534
+ - Remove deprecated `--scheme`/`scheme` and `--host`/`host` cli args/flags - use `REMIX_DEV_ORIGIN` instead ([#6962](https://github.com/remix-run/remix/pull/6962))
1535
+ - Promote the `future.v2_dev` flag in `remix.config.js` to a root level `dev` config ([#7002](https://github.com/remix-run/remix/pull/7002))
1536
+ - Remove `browserBuildDirectory` config option ([#6900](https://github.com/remix-run/remix/pull/6900))
1537
+ - Remove `serverBuildDirectory` config option (\[#6897]\(<https://github.com/remix-run/remix/pull/-> Remove `codemod` command ([#6918](https://github.com/remix-run/remix/pull/6918))
1538
+ 6897\))
1539
+ - Removed support for "magic exports" from the `remix` package. This package can be removed from your `package.json` and you should update all imports to use the source `@remix-run/*` packages: ([#6895](https://github.com/remix-run/remix/pull/6895))
1540
+
1541
+ ```diff
1542
+ - import type { ActionArgs } from "remix";
1543
+ - import { json, useLoaderData } from "remix";
1544
+ + import type { ActionArgs } from "@remix-run/node";
1545
+ + import { json } from "@remix-run/node";
1546
+ + import { useLoaderData } from "@remix-run/react";
1547
+ ```
1548
+
1549
+ ### Minor Changes
1550
+
1551
+ - Warn users about obsolete future flags in `remix.config.js` ([#7048](https://github.com/remix-run/remix/pull/7048))
1552
+ - Detect built mode via `build.mode` ([#6964](https://github.com/remix-run/remix/pull/6964))
1553
+ - Prevents mode mismatch between built Remix server entry and user-land server
1554
+ - Additionally, all runtimes (including non-Node runtimes) can use `build.mode` to determine if HMR should be performed
1555
+ - Support `bun` package manager ([#7074](https://github.com/remix-run/remix/pull/7074))
1556
+ - The `serverNodeBuiltinsPolyfill` option (along with the newly added `browserNodeBuiltinsPolyfill`) now supports defining global polyfills in addition to module polyfills ([#7269](https://github.com/remix-run/remix/pull/7269))
1557
+ - For example, to polyfill Node's `Buffer` global:
1558
+
1559
+ ```js
1560
+ module.exports = {
1561
+ serverNodeBuiltinsPolyfill: {
1562
+ globals: {
1563
+ Buffer: true,
1564
+ },
1565
+ // You'll probably need to polyfill the "buffer" module
1566
+ // too since the global polyfill imports this:
1567
+ modules: {
1568
+ buffer: true,
1569
+ },
1570
+ },
1571
+ };
1572
+ ```
1573
+
1574
+ ### Patch Changes
1575
+
1576
+ - Fix importing of PNGs, SVGs, and other assets from packages in `node_modules` ([#6813](https://github.com/remix-run/remix/pull/6813), [#7182](https://github.com/remix-run/remix/pull/7182))
1577
+
1578
+ - Decouple the `@remix-run/dev` package from the contents of the `@remix-run/css-bundle` package. ([#6982](https://github.com/remix-run/remix/pull/6982))
1579
+ - The contents of the `@remix-run/css-bundle` package are now entirely managed by the Remix compiler
1580
+ - Even though it's still recommended that your Remix dependencies all share the same version, this change ensures that there are no runtime errors when upgrading `@remix-run/dev` without upgrading `@remix-run/css-bundle`
1581
+
1582
+ - Allow non-development modes for `remix watch` ([#7117](https://github.com/remix-run/remix/pull/7117))
1583
+
1584
+ - Stop `remix dev` when `esbuild` is not running ([#7158](https://github.com/remix-run/remix/pull/7158))
1585
+
1586
+ - Do not interpret JSX in `.ts` files ([#7306](https://github.com/remix-run/remix/pull/7306))
1587
+ - While JSX is supported in `.js` files for compatibility with existing apps and libraries,
1588
+ `.ts` files should not contain JSX. By not interpreting `.ts` files as JSX, `.ts` files
1589
+ can contain single-argument type generics without needing a comma to disambiguate from JSX:
1590
+
1591
+ ```ts
1592
+ // this works in .ts files
1593
+ const id = <T>(x: T) => x;
1594
+ // ^ single-argument type generic
1595
+ ```
1596
+
1597
+ ```tsx
1598
+ // this doesn't work in .tsx files
1599
+ const id = <T,>(x: T) => x;
1600
+ // ^ is this a JSX element? or a single-argument type generic?
1601
+ ```
1602
+
1603
+ ```tsx
1604
+ // this works in .tsx files
1605
+ const id = <T,>(x: T) => x;
1606
+ // ^ comma: this is a generic, not a JSX element
1607
+ const component = <h1>hello</h1>;
1608
+ // ^ no comma: this is a JSX element
1609
+ ```
1610
+
1611
+ - Enhance obsolete flag warning for `future.v2_dev` if it was an object, and prompt users to lift it to the root `dev` config ([#7427](https://github.com/remix-run/remix/pull/7427))
1612
+
1613
+ - Allow decorators in app code ([#7176](https://github.com/remix-run/remix/pull/7176))
1614
+
1615
+ - Allow JSX in `.js` files during HMR ([#7112](https://github.com/remix-run/remix/pull/7112))
1616
+
1617
+ - Kill app server when remix dev terminates ([#7280](https://github.com/remix-run/remix/pull/7280))
1618
+
1619
+ - Support dependencies that import polyfill packages for Node built-ins via a trailing slash (e.g. importing the `buffer` package with `var Buffer = require('buffer/').Buffer` as recommended in their README) ([#7198](https://github.com/remix-run/remix/pull/7198))
1620
+ - These imports were previously marked as external
1621
+ - This meant that they were left as dynamic imports in the client bundle and would throw a runtime error in the browser (e.g. `Dynamic require of "buffer/" is not supported`)
1622
+
1623
+ - Surface errors when PostCSS config is invalid ([#7391](https://github.com/remix-run/remix/pull/7391))
1624
+
1625
+ - Restart dev server when Remix config changes ([#7269](https://github.com/remix-run/remix/pull/7269))
1626
+
1627
+ - Remove outdated ESM import warnings ([#6916](https://github.com/remix-run/remix/pull/6916))
1628
+ - Most of the time these warnings were false positives.
1629
+ - Instead, we now rely on built-in Node warnings for ESM imports.
1630
+
1631
+ - Do not trigger rebuilds when `.DS_Store` changes ([#7172](https://github.com/remix-run/remix/pull/7172))
1632
+
1633
+ - Remove warnings for stabilized flags: ([#6905](https://github.com/remix-run/remix/pull/6905))
1634
+ - `unstable_cssSideEffectImports`
1635
+ - `unstable_cssModules`
1636
+ - `unstable_vanillaExtract`
1637
+
1638
+ - Allow any mode (`NODE_ENV`) ([#7113](https://github.com/remix-run/remix/pull/7113))
1639
+
1640
+ - Replace the deprecated [`xdm`](https://github.com/wooorm/xdm) package with [`@mdx-js/mdx`](https://github.com/mdx-js/mdx) ([#4054](https://github.com/remix-run/remix/pull/4054))
1641
+
1642
+ - Write a `version.txt` sentinel file _after_ server build is completely written ([#7299](https://github.com/remix-run/remix/pull/7299))
1643
+
1644
+ - Updated dependencies:
1645
+ - `@remix-run/server-runtime@2.0.0`
1646
+
1647
+ ## 1.19.3
1648
+
1649
+ ### Patch Changes
1650
+
1651
+ - Show deprecation warning when using `devServerBroadcastDelay` and `devServerPort` config options ([#7064](https://github.com/remix-run/remix/pull/7064))
1652
+ - Updated dependencies:
1653
+ - `@remix-run/server-runtime@1.19.3`
1654
+
1655
+ ## 1.19.2
1656
+
1657
+ ### Patch Changes
1658
+
1659
+ - Update `proxy-agent` to resolve npm audit security vulnerability ([#7027](https://github.com/remix-run/remix/pull/7027))
1660
+ - Updated dependencies:
1661
+ - `@remix-run/server-runtime@1.19.2`
1662
+
1663
+ ## 1.19.1
1664
+
1665
+ ### Patch Changes
1666
+
1667
+ - Add a heartbeat ping to prevent the WebSocket connection from being closed due to inactivity when using a proxy like Cloudflare ([#6904](https://github.com/remix-run/remix/pull/6904), [#6927](https://github.com/remix-run/remix/pull/6927))
1668
+ - Treeshake out HMR code from production builds ([#6894](https://github.com/remix-run/remix/pull/6894))
1669
+ - Updated dependencies:
1670
+ - `@remix-run/server-runtime@1.19.1`
1671
+
1672
+ ## 1.19.0
1673
+
1674
+ ### Minor Changes
1675
+
1676
+ - improved networking options for `v2_dev` ([#6724](https://github.com/remix-run/remix/pull/6724))
1677
+
1678
+ deprecate the `--scheme` and `--host` options and replace them with the `REMIX_DEV_ORIGIN` environment variable
1679
+
1680
+ - Output esbuild metafiles for bundle analysis ([#6772](https://github.com/remix-run/remix/pull/6772))
1681
+
1682
+ Written to server build directory (`build/` by default):
1683
+ - `metafile.css.json`
1684
+ - `metafile.js.json` (browser JS)
1685
+ - `metafile.server.json` (server JS)
1686
+
1687
+ Metafiles can be uploaded to <https://esbuild.github.io/analyze/> for analysis.
1688
+
1689
+ - Add `serverNodeBuiltinsPolyfill` config option. In `remix.config.js` you can now disable polyfills of Node.js built-in modules for non-Node.js server platforms, or opt into a subset of polyfills. ([#6814](https://github.com/remix-run/remix/pull/6814), [#6859](https://github.com/remix-run/remix/pull/6859), [#6877](https://github.com/remix-run/remix/pull/6877))
1690
+
1691
+ ```js
1692
+ // Disable all polyfills
1693
+ exports.serverNodeBuiltinsPolyfill = { modules: {} };
1694
+
1695
+ // Enable specific polyfills
1696
+ exports.serverNodeBuiltinsPolyfill = {
1697
+ modules: {
1698
+ crypto: true, // Provide a JSPM polyfill
1699
+ fs: "empty", // Provide an empty polyfill
1700
+ },
1701
+ };
1702
+ ```
1703
+
1704
+ ### Patch Changes
1705
+
1706
+ - ignore missing react-dom/client for react 17 ([#6725](https://github.com/remix-run/remix/pull/6725))
1707
+
1708
+ - Warn if not using `v2_dev` ([#6818](https://github.com/remix-run/remix/pull/6818))
1709
+
1710
+ Also, rename `--no-restart` to `--manual` to match intention and documentation.
1711
+ `--no-restart` remains an alias for `--manual` in v1 for backwards compatibility.
1712
+
1713
+ - ignore errors when killing already dead processes ([#6773](https://github.com/remix-run/remix/pull/6773))
1714
+
1715
+ - Always rewrite css-derived assets during builds ([#6837](https://github.com/remix-run/remix/pull/6837))
1716
+
1717
+ - fix sourcemaps for `v2_dev` ([#6762](https://github.com/remix-run/remix/pull/6762))
1718
+
1719
+ - Do not clear screen when dev server starts ([#6719](https://github.com/remix-run/remix/pull/6719))
1720
+
1721
+ On some terminal emulators, "clearing" only scrolls the next line to the
1722
+ top. on others, it erases the scrollback.
1723
+
1724
+ Instead, let users call `clear` themselves (`clear && remix dev`) if
1725
+ they want to clear.
1726
+
1727
+ - Updated dependencies:
1728
+ - `@remix-run/server-runtime@1.19.0`
1729
+
1730
+ ## 1.18.1
1731
+
1732
+ ### Patch Changes
1733
+
1734
+ - Ignore missing `react-dom/client` for React 17 ([#6725](https://github.com/remix-run/remix/pull/6725))
1735
+ - Updated dependencies:
1736
+ - `@remix-run/server-runtime@1.18.1`
1737
+
1738
+ ## 1.18.0
1739
+
1740
+ ### Minor Changes
1741
+
1742
+ - stabilize v2 dev server ([#6615](https://github.com/remix-run/remix/pull/6615))
1743
+ - improved logging for `remix build` and `remix dev` ([#6596](https://github.com/remix-run/remix/pull/6596))
1744
+
1745
+ ### Patch Changes
1746
+
1747
+ - fix docs links for msw and mkcert ([#6672](https://github.com/remix-run/remix/pull/6672))
1748
+ - fix `remix dev -c`: kill all descendant processes of specified command when restarting ([#6663](https://github.com/remix-run/remix/pull/6663))
1749
+ - Add caching to regular stylesheet compilation ([#6638](https://github.com/remix-run/remix/pull/6638))
1750
+ - Rename `Architect (AWS Lambda)` -> `Architect` in the `create-remix` CLI to avoid confusion for other methods of deploying to AWS (i.e., SST) ([#6484](https://github.com/remix-run/remix/pull/6484))
1751
+ - Improve CSS bundle build performance by skipping unused Node polyfills ([#6639](https://github.com/remix-run/remix/pull/6639))
1752
+ - Improve performance of CSS bundle build by skipping compilation of Remix/React packages that are known not to contain CSS imports ([#6654](https://github.com/remix-run/remix/pull/6654))
1753
+ - Cache CSS side-effect imports transform when using HMR ([#6622](https://github.com/remix-run/remix/pull/6622))
1754
+ - Fix bug with pathless layout routes beneath nested path segments ([#6649](https://github.com/remix-run/remix/pull/6649))
1755
+ - Add caching to PostCSS for CSS Modules ([#6604](https://github.com/remix-run/remix/pull/6604))
1756
+ - Add caching to PostCSS for side-effect imports ([#6554](https://github.com/remix-run/remix/pull/6554))
1757
+ - cache getRouteModuleExports calls to significantly speed up build and HMR rebuild times ([#6629](https://github.com/remix-run/remix/pull/6629))
1758
+ - group rebuild logs with surrounding whitespace ([#6607](https://github.com/remix-run/remix/pull/6607))
1759
+ - instructions for integrating with msw ([#6669](https://github.com/remix-run/remix/pull/6669))
1760
+ - Update minimum version of `esbuild-plugins-node-modules-polyfill` to 1.0.16 to ensure that the plugin is cached ([#6652](https://github.com/remix-run/remix/pull/6652))
1761
+ - Updated dependencies:
1762
+ - `@remix-run/server-runtime@1.18.0`
1763
+
1764
+ ## 1.17.1
1765
+
1766
+ ### Patch Changes
1767
+
1768
+ - Replace `esbuild-plugin-polyfill-node` with `esbuild-plugins-node-modules-polyfill` ([#6562](https://github.com/remix-run/remix/pull/6562))
1769
+ - Lazily generate CSS bundle when import of `@remix-run/css-bundle` is detected ([#6535](https://github.com/remix-run/remix/pull/6535))
1770
+ - Updated dependencies:
1771
+ - `@remix-run/server-runtime@1.17.1`
1772
+
1773
+ ## 1.17.0
1774
+
1775
+ ### Minor Changes
1776
+
1777
+ - built-in tls support ([#6483](https://github.com/remix-run/remix/pull/6483))
1778
+
1779
+ New options:
1780
+ - `--tls-key` / `tlsKey`: TLS key
1781
+ - `--tls-cert` / `tlsCert`: TLS Certificate
1782
+
1783
+ If both TLS options are set, `scheme` defaults to `https`
1784
+
1785
+ ## Example
1786
+
1787
+ Install [mkcert](https://github.com/FiloSottile/mkcert) and create a local CA:
1788
+
1789
+ ```sh
1790
+ brew install mkcert
1791
+ mkcert -install
1792
+ ```
1793
+
1794
+ Then make sure you inform `node` about your CA certs:
1795
+
1796
+ ```sh
1797
+ export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem"
1798
+ ```
1799
+
1800
+ 👆 You'll probably want to put that env var in your scripts or `.bashrc`/`.zshrc`
1801
+
1802
+ Now create `key.pem` and `cert.pem`:
1803
+
1804
+ ```sh
1805
+ mkcert -key-file key.pem -cert-file cert.pem localhost
1806
+ ```
1807
+
1808
+ See `mkcert` docs for more details.
1809
+
1810
+ Finally, pass in the paths to the key and cert via flags:
1811
+
1812
+ ```sh
1813
+ remix dev --tls-key=key.pem --tls-cert=cert.pem
1814
+ ```
1815
+
1816
+ or via config:
1817
+
1818
+ ```js
1819
+ module.exports = {
1820
+ future: {
1821
+ unstable_dev: {
1822
+ tlsKey: "key.pem",
1823
+ tlsCert: "cert.pem",
1824
+ },
1825
+ },
1826
+ };
1827
+ ```
1828
+
1829
+ That's all that's needed to set up the Remix Dev Server with TLS.
1830
+
1831
+ 🚨 Make sure to update your app server for TLS as well.
1832
+
1833
+ For example, with `express`:
1834
+
1835
+ ```ts
1836
+ import fs from "node:fs";
1837
+ import https from "node:https";
1838
+
1839
+ import express from "express";
1840
+
1841
+ const app = express();
1842
+
1843
+ // ...code setting up your express app...
1844
+
1845
+ const appServer = https.createServer(
1846
+ {
1847
+ key: fs.readFileSync("key.pem"),
1848
+ cert: fs.readFileSync("cert.pem"),
1849
+ },
1850
+ app,
1851
+ );
1852
+
1853
+ appServer.listen(3000, () => {
1854
+ console.log("Ready on https://localhost:3000");
1855
+ });
1856
+ ```
1857
+
1858
+ ## Known limitations
1859
+
1860
+ `remix-serve` does not yet support TLS.
1861
+ That means this only works for custom app server using the `-c` flag for now.
1862
+
1863
+ - Reuse dev server port for WebSocket (Live Reload,HMR,HDR) ([#6476](https://github.com/remix-run/remix/pull/6476))
1864
+
1865
+ As a result the `webSocketPort`/`--websocket-port` option has been obsoleted.
1866
+ Additionally, scheme/host/port options for the dev server have been renamed.
1867
+
1868
+ Available options are:
1869
+
1870
+ | Option | flag | config | default |
1871
+ | ---------- | ------------------ | ---------------- | --------------------------------- |
1872
+ | Command | `-c` / `--command` | `command` | `remix-serve <server build path>` |
1873
+ | Scheme | `--scheme` | `scheme` | `http` |
1874
+ | Host | `--host` | `host` | `localhost` |
1875
+ | Port | `--port` | `port` | Dynamically chosen open port |
1876
+ | No restart | `--no-restart` | `restart: false` | `restart: true` |
1877
+
1878
+ Note that scheme/host/port options are for the _dev server_, not your app server.
1879
+ You probably don't need to use scheme/host/port option if you aren't configuring networking (e.g. for Docker or SSL).
1880
+
1881
+ ### Patch Changes
1882
+
1883
+ - Add caching to PostCSS for regular stylesheets ([#6505](https://github.com/remix-run/remix/pull/6505))
1884
+
1885
+ - Fix warnings when importing CSS files with `future.unstable_dev` enabled ([#6506](https://github.com/remix-run/remix/pull/6506))
1886
+
1887
+ - Fix Tailwind performance issue when `postcss.config.js` contains `plugins: { tailwindcss: {} }` and `remix.config.js` contains both `tailwind: true` and `postcss: true`. ([#6468](https://github.com/remix-run/remix/pull/6468))
1888
+
1889
+ Note that this was _not_ an issue when the plugin function had been explicitly called, i.e. `plugins: [tailwindcss()]`. Remix avoids adding the Tailwind plugin to PostCSS if it's already present but we were failing to detect when the plugin function hadn't been called — either because the plugin function itself had been passed, i.e. `plugins: [require('tailwindcss')]`, or the plugin config object syntax had been used, i.e. `plugins: { tailwindcss: {} }`.
1890
+
1891
+ - Faster server export removal for routes when `unstable_dev` is enabled. ([#6455](https://github.com/remix-run/remix/pull/6455))
1892
+
1893
+ Also, only render modulepreloads on SSR.
1894
+ Do not render modulepreloads when hydrated.
1895
+
1896
+ - Add `HeadersArgs` type to be consistent with loaders/actions/meta and allows for using a `function` declaration in addition to an arrow function expression ([#6247](https://github.com/remix-run/remix/pull/6247))
1897
+
1898
+ ```tsx
1899
+ import type { HeadersArgs } from "@remix-run/node"; // or cloudflare/deno
1900
+
1901
+ export function headers({ loaderHeaders }: HeadersArgs) {
1902
+ return {
1903
+ "x-my-custom-thing": loaderHeaders.get("x-my-custom-thing") || "fallback",
1904
+ };
1905
+ }
1906
+ ```
1907
+
1908
+ - better error message when `remix-serve` is not found ([#6477](https://github.com/remix-run/remix/pull/6477))
1909
+
1910
+ - restore color for app server output ([#6485](https://github.com/remix-run/remix/pull/6485))
1911
+
1912
+ - Fix route ranking bug with pathless layout route next to a sibling index route ([#4421](https://github.com/remix-run/remix/pull/4421))
1913
+ - Under the hood this is done by removing the trailing slash from all generated `path` values since the number of slash-delimited segments counts towards route ranking so the trailing slash incorrectly increases the score for routes
1914
+
1915
+ - Support sibling pathless layout routes by removing pathless layout routes from the unique route path checks in conventional route generation since they inherently trigger duplicate paths ([#4421](https://github.com/remix-run/remix/pull/4421))
1916
+
1917
+ - fix dev server crashes caused by ungraceful hdr error handling ([#6467](https://github.com/remix-run/remix/pull/6467))
1918
+
1919
+ - Updated dependencies:
1920
+ - `@remix-run/server-runtime@1.17.0`
1921
+
1922
+ ## 1.16.1
1923
+
1924
+ ### Patch Changes
1925
+
1926
+ - Cross-module `loader` change detection for HDR ([#6299](https://github.com/remix-run/remix/pull/6299))
1927
+ - Normalize path for dev server `PATH` envvar so that it works cross-platform (e.g. Windows) ([#6310](https://github.com/remix-run/remix/pull/6310))
1928
+ - Fix CSS imports in JS files that use JSX ([#6309](https://github.com/remix-run/remix/pull/6309))
1929
+ - Kill app server when dev server exits ([#6395](https://github.com/remix-run/remix/pull/6395))
1930
+ - Wait until app server is killed before starting a new app server ([#6289](https://github.com/remix-run/remix/pull/6289))
1931
+ - Ensure CSS bundle changes result in a new manifest hash ([#6374](https://github.com/remix-run/remix/pull/6374))
1932
+ - Normalize file paths before testing if a changed file is a route entry ([#6293](https://github.com/remix-run/remix/pull/6293))
1933
+ - Fix race where app server responds with updated manifest version _before_ dev server is listening for it ([#6294](https://github.com/remix-run/remix/pull/6294))
1934
+ - dev server now listens for updated versions _before_ writing the server changes, guaranteeing that it is listening before the app server gets a chance to send its 'ready' message
1935
+ - Only process `.css.ts`/`.css.js` files with Vanilla Extract if `@vanilla-extract/css` is installed ([#6345](https://github.com/remix-run/remix/pull/6345))
1936
+ - Stop modifying a user's `tsconfig.json` when running using `getConfig` (`remix dev`, `remix routes`, `remix build`, etc) ([#6156](https://github.com/remix-run/remix/pull/6156))
1937
+ - Cancel previous build when rebuild is kicked off to prevent rebuilds from hanging ([#6295](https://github.com/remix-run/remix/pull/6295))
1938
+ - Update minimum version of Babel dependencies to avoid errors parsing decorators ([#6390](https://github.com/remix-run/remix/pull/6390))
1939
+ - Support asset imports when detecting loader changes for HDR ([#6396](https://github.com/remix-run/remix/pull/6396))
1940
+ - Updated dependencies:
1941
+ - `@remix-run/server-runtime@1.16.1`
1942
+
1943
+ ## 1.16.0
1944
+
1945
+ ### Minor Changes
1946
+
1947
+ - Enable support for [CSS Modules](https://github.com/css-modules/css-modules), [Vanilla Extract](http://vanilla-extract.style) and CSS side-effect imports ([#6046](https://github.com/remix-run/remix/pull/6046))
1948
+
1949
+ These CSS bundling features were previously only available via `future.unstable_cssModules`, `future.unstable_vanillaExtract` and `future.unstable_cssSideEffectImports` options in `remix.config.js`, but they have now been stabilized.
1950
+
1951
+ In order to use these features, check out our guide to [CSS bundling](https://remix.run/docs/en/1.16.0/guides/styling#css-bundling) in your project.
1952
+
1953
+ - Stabilize built-in PostCSS support via the new `postcss` option in `remix.config.js`. As a result, the `future.unstable_postcss` option has also been deprecated. ([#5960](https://github.com/remix-run/remix/pull/5960))
1954
+
1955
+ The `postcss` option is `false` by default, but when set to `true` will enable processing of all CSS files using PostCSS if `postcss.config.js` is present.
1956
+
1957
+ If you followed the original PostCSS setup guide for Remix, you may have a folder structure that looks like this, separating your source files from its processed output:
1958
+
1959
+ .
1960
+ ├── app
1961
+ │ └── styles (processed files)
1962
+ │ ├── app.css
1963
+ │ └── routes
1964
+ │ └── index.css
1965
+ └── styles (source files)
1966
+ ├── app.css
1967
+ └── routes
1968
+ └── index.css
1969
+
1970
+ After you've enabled the new `postcss` option, you can delete the processed files from `app/styles` folder and move your source files from `styles` to `app/styles`:
1971
+
1972
+ .
1973
+ ├── app
1974
+ │ └── styles (source files)
1975
+ │ ├── app.css
1976
+ │ └── routes
1977
+ │ └── index.css
1978
+
1979
+ You should then remove `app/styles` from your `.gitignore` file since it now contains source files rather than processed output.
1980
+
1981
+ You can then update your `package.json` scripts to remove any usage of `postcss` since Remix handles this automatically. For example, if you had followed the original setup guide:
1982
+
1983
+ ```diff
1984
+ {
1985
+ "scripts": {
1986
+ - "dev:css": "postcss styles --base styles --dir app/styles -w",
1987
+ - "build:css": "postcss styles --base styles --dir app/styles --env production",
1988
+ - "dev": "concurrently \"npm run dev:css\" \"remix dev\""
1989
+ + "dev": "remix dev"
1990
+ }
1991
+ }
1992
+ ```
1993
+
1994
+ - Stabilize built-in Tailwind support via the new `tailwind` option in `remix.config.js`. As a result, the `future.unstable_tailwind` option has also been deprecated. ([#5960](https://github.com/remix-run/remix/pull/5960))
1995
+
1996
+ The `tailwind` option is `false` by default, but when set to `true` will enable built-in support for Tailwind functions and directives in your CSS files if `tailwindcss` is installed.
1997
+
1998
+ If you followed the original Tailwind setup guide for Remix and want to make use of this feature, you should first delete the generated `app/tailwind.css`.
1999
+
2000
+ Then, if you have a `styles/tailwind.css` file, you should move it to `app/tailwind.css`.
2001
+
2002
+ ```sh
2003
+ rm app/tailwind.css
2004
+ mv styles/tailwind.css app/tailwind.css
2005
+ ```
2006
+
2007
+ Otherwise, if you don't already have an `app/tailwind.css` file, you should create one with the following contents:
2008
+
2009
+ ```css
2010
+ @tailwind base;
2011
+ @tailwind components;
2012
+ @tailwind utilities;
2013
+ ```
2014
+
2015
+ You should then remove `/app/tailwind.css` from your `.gitignore` file since it now contains source code rather than processed output.
2016
+
2017
+ You can then update your `package.json` scripts to remove any usage of `tailwindcss` since Remix handles this automatically. For example, if you had followed the original setup guide:
2018
+
2019
+ ```diff
2020
+ {
2021
+ // ...
2022
+ "scripts": {
2023
+ - "build": "run-s \"build:*\"",
2024
+ + "build": "remix build",
2025
+ - "build:css": "npm run generate:css -- --minify",
2026
+ - "build:remix": "remix build",
2027
+ - "dev": "run-p \"dev:*\"",
2028
+ + "dev": "remix dev",
2029
+ - "dev:css": "npm run generate:css -- --watch",
2030
+ - "dev:remix": "remix dev",
2031
+ - "generate:css": "npx tailwindcss -o ./app/tailwind.css",
2032
+ "start": "remix-serve build"
2033
+ }
2034
+ // ...
2035
+ }
2036
+ ```
2037
+
2038
+ - The Remix dev server spins up your app server as a managed subprocess. ([#6133](https://github.com/remix-run/remix/pull/6133))
2039
+ This keeps your development environment as close to production as possible.
2040
+ It also means that the Remix dev server is compatible with _any_ app server.
2041
+
2042
+ By default, the dev server will use the Remix App Server, but you opt to use your own app server by specifying the command to run it via the `-c`/`--command` flag:
2043
+
2044
+ ```sh
2045
+ remix dev # uses `remix-serve <serve build path>` as the app server
2046
+ remix dev -c "node ./server.js" # uses your custom app server at `./server.js`
2047
+ ```
2048
+
2049
+ The dev server will:
2050
+ - force `NODE_ENV=development` and warn you if it was previously set to something else
2051
+ - rebuild your app whenever your Remix app code changes
2052
+ - restart your app server whenever rebuilds succeed
2053
+ - handle live reload and HMR + Hot Data Revalidation
2054
+
2055
+ ### App server coordination
2056
+
2057
+ In order to manage your app server, the dev server needs to be told what server build is currently being used by your app server.
2058
+ This works by having the app server send a "I'm ready!" message with the Remix server build hash as the payload.
2059
+
2060
+ This is handled automatically in Remix App Server and is set up for you via calls to `broadcastDevReady` or `logDevReady` in the official Remix templates.
2061
+
2062
+ If you are not using Remix App Server and your server doesn't call `broadcastDevReady`, you'll need to call it in your app server _after_ it is up and running.
2063
+ For example, in an Express server:
2064
+
2065
+ ```js
2066
+ // server.js
2067
+ // <other imports>
2068
+ import { broadcastDevReady } from "@remix-run/node";
2069
+
2070
+ // Path to Remix's server build directory ('build/' by default)
2071
+ const BUILD_DIR = path.join(process.cwd(), "build");
2072
+
2073
+ // <code setting up your express server>
2074
+
2075
+ app.listen(3000, () => {
2076
+ const build = require(BUILD_DIR);
2077
+ console.log("Ready: http://localhost:" + port);
2078
+
2079
+ // in development, call `broadcastDevReady` _after_ your server is up and running
2080
+ if (process.env.NODE_ENV === "development") {
2081
+ broadcastDevReady(build);
2082
+ }
2083
+ });
2084
+ ```
2085
+
2086
+ ### Options
2087
+
2088
+ Options priority order is: 1. flags, 2. config, 3. defaults.
2089
+
2090
+ | Option | flag | config | default |
2091
+ | -------------- | ------------------ | ---------------- | --------------------------------- |
2092
+ | Command | `-c` / `--command` | `command` | `remix-serve <server build path>` |
2093
+ | HTTP(S) scheme | `--http-scheme` | `httpScheme` | `http` |
2094
+ | HTTP(S) host | `--http-host` | `httpHost` | `localhost` |
2095
+ | HTTP(S) port | `--http-port` | `httpPort` | Dynamically chosen open port |
2096
+ | Websocket port | `--websocket-port` | `websocketPort` | Dynamically chosen open port |
2097
+ | No restart | `--no-restart` | `restart: false` | `restart: true` |
2098
+
2099
+ 🚨 The `--http-*` flags are only used for internal dev server <-> app server communication.
2100
+ Your app will run on your app server's normal URL.
2101
+
2102
+ To set `unstable_dev` configuration, replace `unstable_dev: true` with `unstable_dev: { <options> }`.
2103
+ For example, to set the HTTP(S) port statically:
2104
+
2105
+ ```js
2106
+ // remix.config.js
2107
+ module.exports = {
2108
+ future: {
2109
+ unstable_dev: {
2110
+ httpPort: 8001,
2111
+ },
2112
+ },
2113
+ };
2114
+ ```
2115
+
2116
+ #### SSL and custom hosts
2117
+
2118
+ You should only need to use the `--http-*` flags and `--websocket-port` flag if you need fine-grain control of what scheme/host/port for the dev server.
2119
+ If you are setting up SSL or Docker networking, these are the flags you'll want to use.
2120
+
2121
+ 🚨 Remix **will not** set up SSL and custom host for you.
2122
+ The `--http-scheme` and `--http-host` flag are for you to tell Remix how you've set things up.
2123
+ It is your task to set up SSL certificates and host files if you want those features.
2124
+
2125
+ #### `--no-restart` and `require` cache purging
2126
+
2127
+ If you want to manage server changes yourself, you can use the `--no-restart` flag to tell the dev server to refrain from restarting your app server when builds succeed:
2128
+
2129
+ ```sh
2130
+ remix dev -c "node ./server.js" --no-restart
2131
+ ```
2132
+
2133
+ For example, you could purge the `require` cache of your app server to keep it running while picking up server changes.
2134
+ If you do so, you should watch the server build path (`build/` by default) for changes and only purge the `require` cache when changes are detected.
2135
+
2136
+ 🚨 If you use `--no-restart`, it is your responsibility to call `broadcastDevReady` when your app server has picked up server changes.
2137
+ For example, with `chokidar`:
2138
+
2139
+ ```js
2140
+ // server.dev.js
2141
+ const BUILD_PATH = path.resolve(__dirname, "build");
2142
+
2143
+ const watcher = chokidar.watch(BUILD_PATH);
2144
+
2145
+ watcher.on("change", () => {
2146
+ // 1. purge require cache
2147
+ purgeRequireCache();
2148
+ // 2. load updated server build
2149
+ const build = require(BUILD_PATH);
2150
+ // 3. tell dev server that this app server is now ready
2151
+ broadcastDevReady(build);
2152
+ });
2153
+ ```
2154
+
2155
+ ### Patch Changes
2156
+
2157
+ - Fix absolute paths in CSS `url()` rules when using CSS Modules, Vanilla Extract and CSS side-effect imports ([#5788](https://github.com/remix-run/remix/pull/5788))
2158
+ - look for @remix-run/serve in `devDependencies` when running remix dev ([#6228](https://github.com/remix-run/remix/pull/6228))
2159
+ - add warning for v2 "cjs"->"esm" `serverModuleFormat` default change ([#6154](https://github.com/remix-run/remix/pull/6154))
2160
+ - write mjs server output files ([#6225](https://github.com/remix-run/remix/pull/6225))
2161
+ - fix(react,dev): dev chunking and refresh race condition ([#6201](https://github.com/remix-run/remix/pull/6201))
2162
+ - Use correct require context in `bareImports` plugin. ([#6181](https://github.com/remix-run/remix/pull/6181))
2163
+ - use minimatch for regex instead of glob-to-regexp ([#6017](https://github.com/remix-run/remix/pull/6017))
2164
+ - add `logDevReady` as replacement for platforms that can't initialize async I/O outside of the request response lifecycle. ([#6204](https://github.com/remix-run/remix/pull/6204))
2165
+ - Use the "automatic" JSX runtime when processing MDX files. ([#6098](https://github.com/remix-run/remix/pull/6098))
2166
+ - forcibly kill app server during dev ([#6197](https://github.com/remix-run/remix/pull/6197))
2167
+ - show first compilation error instead of cancelation errors ([#6202](https://github.com/remix-run/remix/pull/6202))
2168
+ - Resolve imports from route modules across the graph back to the virtual module created by the v2 routes plugin. This fixes issues where we would duplicate portions of route modules that were imported. ([#6098](https://github.com/remix-run/remix/pull/6098))
2169
+ - Updated dependencies:
2170
+ - `@remix-run/server-runtime@1.16.0`
2171
+
2172
+ ## 1.15.0
2173
+
2174
+ ### Minor Changes
2175
+
2176
+ - Added deprecation warning for `v2_normalizeFormMethod` ([#5863](https://github.com/remix-run/remix/pull/5863))
2177
+
2178
+ - Added a new `future.v2_normalizeFormMethod` flag to normalize the exposed `useNavigation().formMethod` as an uppercase HTTP method to align with the previous `useTransition` behavior as well as the `fetch()` behavior of normalizing to uppercase HTTP methods. ([#5815](https://github.com/remix-run/remix/pull/5815))
2179
+ - When `future.v2_normalizeFormMethod === false`,
2180
+ - `useNavigation().formMethod` is lowercase
2181
+ - `useFetcher().formMethod` is uppercase
2182
+ - When `future.v2_normalizeFormMethod === true`:
2183
+ - `useNavigation().formMethod` is uppercase
2184
+ - `useFetcher().formMethod` is uppercase
2185
+
2186
+ - Added deprecation warning for `browserBuildDirectory` in `remix.config` ([#5702](https://github.com/remix-run/remix/pull/5702))
2187
+
2188
+ - Added deprecation warning for `CatchBoundary` in favor of `future.v2_errorBoundary` ([#5718](https://github.com/remix-run/remix/pull/5718))
2189
+
2190
+ - Added experimental support for Vanilla Extract caching, which can be enabled by setting `future.unstable_vanillaExtract: { cache: true }` in `remix.config`. This is considered experimental due to the use of a brand new Vanilla Extract compiler under the hood. In order to use this feature, you must be using at least `v1.10.0` of `@vanilla-extract/css`. ([#5735](https://github.com/remix-run/remix/pull/5735))
2191
+
2192
+ - Added deprecation warning for `serverBuildDirectory` in `remix.config` ([#5704](https://github.com/remix-run/remix/pull/5704))
2193
+
2194
+ ### Patch Changes
2195
+
2196
+ - Fixed issue to ensure changes to CSS inserted via `@remix-run/css-bundle` are picked up during HMR ([#5823](https://github.com/remix-run/remix/pull/5823))
2197
+ - We now use `path.resolve` when re-exporting `entry.client` ([#5707](https://github.com/remix-run/remix/pull/5707))
2198
+ - Added support for `.mjs` and `.cjs` extensions when detecting CSS side-effect imports ([#5564](https://github.com/remix-run/remix/pull/5564))
2199
+ - Fixed resolution issues for pnpm users installing `react-refresh` ([#5637](https://github.com/remix-run/remix/pull/5637))
2200
+ - Added deprecation warning for `future.v2_meta` ([#5878](https://github.com/remix-run/remix/pull/5878))
2201
+ - Added optional entry file support for React 17 ([#5681](https://github.com/remix-run/remix/pull/5681))
2202
+ - Updated dependencies:
2203
+ - `@remix-run/server-runtime@1.15.0`
2204
+
2205
+ ## 1.14.3
2206
+
2207
+ ### Patch Changes
2208
+
2209
+ - dev server is resilient to build failures ([#5795](https://github.com/remix-run/remix/pull/5795))
2210
+ - Updated dependencies:
2211
+ - `@remix-run/server-runtime@1.14.3`
2212
+
2213
+ ## 1.14.2
2214
+
2215
+ ### Patch Changes
2216
+
2217
+ - remove premature deprecation warnings ([#5790](https://github.com/remix-run/remix/pull/5790))
2218
+ - Updated dependencies:
2219
+ - `@remix-run/server-runtime@1.14.2`
2220
+
2221
+ ## 1.14.1
2222
+
2223
+ ### Patch Changes
2224
+
2225
+ - Add types for importing `*.ico` files ([#5430](https://github.com/remix-run/remix/pull/5430))
2226
+ - Allow `moduleResolution: "bundler"` in tsconfig.json ([#5576](https://github.com/remix-run/remix/pull/5576))
2227
+ - Fix issue with x-route imports creating multiple entries in the module graph ([#5721](https://github.com/remix-run/remix/pull/5721))
2228
+ - Add `serverBuildTarget` deprecation warning ([#5624](https://github.com/remix-run/remix/pull/5624))
2229
+ - Updated dependencies:
2230
+ - `@remix-run/server-runtime@1.14.1`
2231
+
2232
+ ## 1.14.0
2233
+
2234
+ ### Minor Changes
2235
+
2236
+ - Hot Module Replacement and Hot Data Revalidation ([#5259](https://github.com/remix-run/remix/pull/5259))
2237
+ - Requires `unstable_dev` future flag to be enabled
2238
+ - HMR provided through React Refresh
2239
+ - Features:
2240
+ - HMR for component and style changes
2241
+ - HDR when loaders for current route change
2242
+ - Known limitations for MVP:
2243
+ - Only implemented for React via React Refresh
2244
+ - No `import.meta.hot` API exposed yet
2245
+ - Revalidates _all_ loaders on route when loader changes are detected
2246
+ - Loader changes do not account for imported dependencies changing
2247
+ - Make `entry.client` and `entry.server` files optional ([#4600](https://github.com/remix-run/remix/pull/4600))
2248
+ - we'll use a bundled version of each unless you provide your own
2249
+
2250
+ ### Patch Changes
2251
+
2252
+ - Fixes flat route inconsistencies where `route.{ext}` wasn't always being treated like `index.{ext}` when used in a folder ([#5459](https://github.com/remix-run/remix/pull/5459))
2253
+ - Route conflict no longer throw errors and instead display a helpful warning that we're using the first one we found.
2254
+
2255
+ ```log
2256
+ ⚠️ Route Path Collision: "/dashboard"
2257
+
2258
+ The following routes all define the same URL, only the first one will be used
2259
+
2260
+ 🟢️️ routes/dashboard/route.tsx
2261
+ ⭕️️ routes/dashboard.tsx
2262
+ ```
2263
+
2264
+ ```log
2265
+ ⚠️ Route Path Collision: "/"
2266
+
2267
+ The following routes all define the same URL, only the first one will be used
2268
+
2269
+ 🟢️️ routes/_landing._index.tsx
2270
+ ⭕️️ routes/_dashboard._index.tsx
2271
+ ⭕️ routes/_index.tsx
2272
+ ```
2273
+
2274
+ - Log errors thrown during initial build in development. ([#5441](https://github.com/remix-run/remix/pull/5441))
2275
+
2276
+ - Sync `FutureConfig` interface between packages ([#5398](https://github.com/remix-run/remix/pull/5398))
2277
+
2278
+ - Add file loader for importing `.csv` files ([#3920](https://github.com/remix-run/remix/pull/3920))
2279
+
2280
+ - Updated dependencies:
2281
+ - `@remix-run/server-runtime@1.14.0`
2282
+
2283
+ ## 1.13.0
2284
+
2285
+ ### Minor Changes
2286
+
2287
+ - We are deprecating `serverBuildTarget` in `remix.config`. See the [release notes for v1.13.0](https://github.com/remix-run/remix/releases/tag/remix%401.13.0) for more information. ([#5354](https://github.com/remix-run/remix/pull/5354))
2288
+ - Add built-in support for PostCSS via the `future.unstable_postcss` feature flag ([#5229](https://github.com/remix-run/remix/pull/5229))
2289
+ - Add built-in support for Tailwind via the `future.unstable_tailwind` feature flag ([#5229](https://github.com/remix-run/remix/pull/5229))
2290
+
2291
+ ### Patch Changes
2292
+
2293
+ - Mark Vanilla Extract files as side effects to ensure that files only containing global styles aren't tree-shaken ([#5246](https://github.com/remix-run/remix/pull/5246))
2294
+ - Support decorators in files using CSS side-effect imports ([#5305](https://github.com/remix-run/remix/pull/5305))
2295
+ - We made several Flat route fixes and enhancements. See the [release notes for v1.13.0](https://github.com/remix-run/remix/releases/tag/remix%401.13.0) for more information. ([#5228](https://github.com/remix-run/remix/pull/5228))
2296
+ - Updated dependencies:
2297
+ - `@remix-run/server-runtime@1.13.0`
2298
+
2299
+ ## 1.12.0
2300
+
2301
+ ### Minor Changes
2302
+
2303
+ - Added a new development server available in the Remix config under the `unstable_dev` flag. [See the release notes](https://github.com/remix-run/remix/releases/tag/remix%401.12.0) for a full description. ([#5133](https://github.com/remix-run/remix/pull/5133))
2304
+
2305
+ ### Patch Changes
2306
+
2307
+ - Fixed issues with `v2_routeConvention` on Windows so that new and renamed files are properly included ([#5266](https://github.com/remix-run/remix/pull/5266))
2308
+ - Server build should not be removed in `remix watch` and `remix dev` ([#5228](https://github.com/remix-run/remix/pull/5228))
2309
+ - The dev server will now clean up build directories whenever a rebuild starts ([#5223](https://github.com/remix-run/remix/pull/5223))
2310
+ - Updated dependencies:
2311
+ - `@remix-run/server-runtime@1.12.0`
2312
+
2313
+ ## 1.11.1
2314
+
2315
+ ### Patch Changes
2316
+
2317
+ - Fixed a bug with `v2_routeConvention` that prevented `index` modules from being recognized for route paths ([`195291a3d`](https://github.com/remix-run/remix/commit/195291a3d8c0e098931199bcc26277a45cee0eb9))
2318
+ - Updated dependencies:
2319
+ - `@remix-run/server-runtime@1.11.1`
2320
+
2321
+ ## 1.11.0
2322
+
2323
+ ### Minor Changes
2324
+
2325
+ - Specify file loader for `.fbx`, `.glb`, `.gltf`, `.hdr`, and `.mov` files ([#5030](https://github.com/remix-run/remix/pull/5030))
2326
+ - Added support for [Vanilla Extract](https://vanilla-extract.style) via the `unstable_vanillaExtract` future flag. **IMPORTANT:** Features marked with `unstable` are … unstable. While we're confident in the use cases they solve, the API and implementation may change without a major version bump. ([#5040](https://github.com/remix-run/remix/pull/5040))
2327
+ - Add support for CSS side-effect imports via the `unstable_cssSideEffectImports` future flag. **IMPORTANT:** Features marked with `unstable` are … unstable. While we're confident in the use cases they solve, the API and implementation may change without a major version bump. ([#4919](https://github.com/remix-run/remix/pull/4919))
2328
+ - Add support for CSS Modules via the `unstable_cssModules` future flag. **IMPORTANT:** Features marked with `unstable` are … unstable. While we're confident in the use cases they solve, the API and implementation may change without a major version bump. ([#4852](https://github.com/remix-run/remix/pull/4852))
2329
+
2330
+ ### Patch Changes
2331
+
2332
+ - Add new "flat" routing conventions. This convention will be the default in v2 but is available now under the `v2_routeConvention` future flag. ([#4880](https://github.com/remix-run/remix/pull/4880))
2333
+ - Added support for `handle` in MDX frontmatter ([#4865](https://github.com/remix-run/remix/pull/4865))
2334
+ - Updated dependencies:
2335
+ - `@remix-run/server-runtime@1.11.0`
2336
+
2337
+ ## 1.10.1
2338
+
2339
+ ### Patch Changes
2340
+
2341
+ - Update babel config to transpile down to node 14 ([#5047](https://github.com/remix-run/remix/pull/5047))
2342
+ - Updated dependencies:
2343
+ - `@remix-run/server-runtime@1.10.1`
2344
+
2345
+ ## 1.10.0
2346
+
2347
+ ### Patch Changes
2348
+
2349
+ - Fixed several issues with TypeScript to JavaScript conversion when running `create-remix` ([#4891](https://github.com/remix-run/remix/pull/4891))
2350
+ - Resolve asset entry full path to support monorepo import of styles ([#4855](https://github.com/remix-run/remix/pull/4855))
2351
+ - Updated dependencies:
2352
+ - `@remix-run/server-runtime@1.10.0`
2353
+
2354
+ ## 1.9.0
2355
+
2356
+ ### Minor Changes
2357
+
2358
+ - Allow defining multiple routes for the same route module file ([#3970](https://github.com/remix-run/remix/pull/3970))
2359
+ - Added support and conventions for optional route segments ([#4706](https://github.com/remix-run/remix/pull/4706))
2360
+
2361
+ ### Patch Changes
2362
+
2363
+ - The Remix compiler now supports new Typescript 4.9 syntax (like the `satisfies` keyword) ([#4754](https://github.com/remix-run/remix/pull/4754))
2364
+ - Optimize `parentRouteId` lookup in `defineConventionalRoutes`. ([#4800](https://github.com/remix-run/remix/pull/4800))
2365
+ - Fixed a bug in `.ts` -> `.js` conversion on Windows by using a relative unix-style path ([#4718](https://github.com/remix-run/remix/pull/4718))
2366
+ - Updated dependencies:
2367
+ - `@remix-run/server-runtime@1.9.0`
2368
+
2369
+ ## 1.8.2
2370
+
2371
+ ### Patch Changes
2372
+
2373
+ - Updated dependencies:
2374
+ - `@remix-run/server-runtime@1.8.2`
2375
+ - `@remix-run/serve@1.8.2`
2376
+
2377
+ ## 1.8.1
2378
+
2379
+ ### Patch Changes
2380
+
2381
+ - Added a missing type definition for the Remix config `future` option to the `@remix-run/dev/server-build` virtual module ([#4771](https://github.com/remix-run/remix/pull/4771))
2382
+ - Updated dependencies:
2383
+ - `@remix-run/serve@1.8.1`
2384
+ - `@remix-run/server-runtime@1.8.1`
2385
+
2386
+ ## 1.8.0
2387
+
2388
+ ### Minor Changes
2389
+
2390
+ - Added support for a new route `meta` API to handle arrays of tags instead of an object. For details, check out the [RFC](https://github.com/remix-run/remix/discussions/4462). ([#4610](https://github.com/remix-run/remix/pull/4610))
2391
+
2392
+ ### Patch Changes
2393
+
2394
+ - Importing functions and types from the `remix` package is deprecated, and all exported modules will be removed in the next major release. For more details,[see the release notes for 1.4.0](https://github.com/remix-run/remix/releases/tag/v1.4.0) where these changes were first announced. ([#4661](https://github.com/remix-run/remix/pull/4661))
2395
+ - Updated dependencies:
2396
+ - `@remix-run/server-runtime@1.8.0`
2397
+ - `@remix-run/serve@1.8.0`
2398
+
2399
+ ## 1.7.6
2400
+
2401
+ ### Patch Changes
2402
+
2403
+ - Updated dependencies:
2404
+ - `@remix-run/serve@1.7.6`
2405
+ - `@remix-run/server-runtime@1.7.6`
2406
+
2407
+ ### Patch Changes
2408
+
2409
+ - Updated dependencies:
2410
+ - `@remix-run/serve@1.7.6-pre.0`
2411
+ - `@remix-run/server-runtime@1.7.6-pre.0`
2412
+
2413
+ ## 1.7.5
2414
+
2415
+ ### Patch Changes
2416
+
2417
+ - Updated dependencies:
2418
+ - `@remix-run/serve@1.7.5`
2419
+ - `@remix-run/server-runtime@1.7.5`
2420
+
2421
+ ## 1.7.4
2422
+
2423
+ ### Patch Changes
2424
+
2425
+ - Updated dependencies:
2426
+ - `@remix-run/server-runtime@1.7.4`
2427
+ - `@remix-run/serve@1.7.4`
2428
+
2429
+ ## 1.7.3
2430
+
2431
+ ### Patch Changes
2432
+
2433
+ - Update `create-remix` to use the new examples repository when using `--template example/<name>` ([#4208](https://github.com/remix-run/remix/pull/4208))
2434
+ - Add support for setting `moduleResolution` to `node`, `node16` or `nodenext` in `tsconfig.json`. ([#4034](https://github.com/remix-run/remix/pull/4034))
2435
+ - Add resources imported only by resource routes to `assetsBuildDirectory` ([#3841](https://github.com/remix-run/remix/pull/3841))
2436
+ - Ensure that any assets referenced in CSS files are hashed and copied to the `assetsBuildDirectory`. ([#4130](https://github.com/remix-run/remix/pull/4130))
2437
+ - Updated dependencies:
2438
+ - `@remix-run/serve@1.7.3`
2439
+ - `@remix-run/server-runtime@1.7.3`
2440
+
2441
+ ## 1.7.2
2442
+
2443
+ ### Patch Changes
2444
+
2445
+ - Updated dependencies:
2446
+ - `@remix-run/server-runtime@1.7.2`
2447
+ - `@remix-run/serve@1.7.2`
2448
+
2449
+ ## 1.7.1
2450
+
2451
+ ### Patch Changes
2452
+
2453
+ - Updated dependencies:
2454
+ - `@remix-run/server-runtime@1.7.1`
2455
+ - `@remix-run/serve@1.7.1`
2456
+
2457
+ ## 1.7.0
2458
+
2459
+ ### Minor Changes
2460
+
2461
+ - Added support for importing `.gql` and `.graphql` files as plain text ([#3923](https://github.com/remix-run/remix/pull/3923))
2462
+ - Added support for importing `.zip` and `.avif` files as resource URLs ([#3985](https://github.com/remix-run/remix/pull/3985))
2463
+
2464
+ ### Patch Changes
2465
+
2466
+ - Removed our compiler's React shim in favor of esbuild's new automatic JSX transform ([#3860](https://github.com/remix-run/remix/pull/3860))
2467
+ - Updated dependencies:
2468
+ - `@remix-run/server-runtime@1.7.0`
2469
+ - `@remix-run/serve@1.7.0`
2470
+
2471
+ ## 1.6.8
2472
+
2473
+ ### Patch Changes
2474
+
2475
+ - Added support for `.mjs` and `.cjs` file extensions for `remix.config` ([#3675](https://github.com/remix-run/remix/pull/3675))
2476
+ - Added support for importing `.sql` files as text content ([#3190](https://github.com/remix-run/remix/pull/3190))
2477
+ - Updated the compiler to make MDX builds deterministic (and a little faster!) ([#3966](https://github.com/remix-run/remix/pull/3966))
2478
+ - Updated dependencies:
2479
+ - `@remix-run/server-runtime@1.6.8`
2480
+ - `@remix-run/serve@1.6.8`
2481
+
2482
+ ## 1.6.7
2483
+
2484
+ ### Patch Changes
2485
+
2486
+ - Remove logical nullish assignment, which is incompatible with Node v14. ([#3880](https://github.com/remix-run/remix/pull/3880))
2487
+ - Don't show ESM warnings when consumed via dynamic import. ([#3872](https://github.com/remix-run/remix/pull/3872))
2488
+ - Updated dependencies:
2489
+ - `@remix-run/serve@1.6.7`
2490
+ - `@remix-run/server-runtime@1.6.7`
2491
+
2492
+ ## 1.6.6
2493
+
2494
+ ### Patch Changes
2495
+
2496
+ - Write server build output files so that only assets imported from resource routes are written to disk ([#3817](https://github.com/remix-run/remix/pull/3817))
2497
+ - Add support for exporting links in `.mdx` files ([#3801](https://github.com/remix-run/remix/pull/3801))
2498
+ - Ensure that build hashing is deterministic ([#2027](https://github.com/remix-run/remix/pull/2027))
2499
+ - Fix types for `@remix-run/dev/server-build` virtual module ([#3743](https://github.com/remix-run/remix/pull/3743))
2500
+ - Updated dependencies:
2501
+ - `@remix-run/serve@1.6.6`
2502
+ - `@remix-run/server-runtime@1.6.6`
2503
+
2504
+ ## 1.6.5
2505
+
2506
+ ### Patch Changes
2507
+
2508
+ - Update `serverBareModulesPlugin` warning to use full import path ([#3656](https://github.com/remix-run/remix/pull/3656))
2509
+ - Fix broken `--port` flag in `create-remix` ([#3694](https://github.com/remix-run/remix/pull/3694))
2510
+ - Updated dependencies
2511
+ - `@remix-run/server-runtime`
2512
+ - `@remix-run/serve`