|
1 | 1 | # `@remix-run/dev`
|
2 | 2 |
|
| 3 | +## 1.12.0-pre.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- # The new dev server ([#5133](https://github.com/remix-run/remix/pull/5133)) |
| 8 | + |
| 9 | + The new dev flow is to spin up the dev server _alongside_ your normal Remix app server: |
| 10 | + |
| 11 | + ```sh |
| 12 | + # spin up the new dev server |
| 13 | + remix dev |
| 14 | + |
| 15 | + # spin up your app server in a separate tab or via `concurrently` |
| 16 | + nodemon ./server.js |
| 17 | + ``` |
| 18 | + |
| 19 | + The dev server will build your app in dev mode and then rebuild whenever any app files change. |
| 20 | + It will also wait for your app server to be "ready" (more on this later) before triggering a live reload in your browser. |
| 21 | + |
| 22 | + ## Benefits |
| 23 | + |
| 24 | + - Navigations no longer wipe in-memory references (e.g. database connections, in-memory caches, etc...). That means no need to use `global` trick anymore. |
| 25 | + - Supports _any_ app server, not just the Remix App Server. |
| 26 | + - Automatically wires up the live reload port for you (no need for you to mess with env vars for that anymore) |
| 27 | + |
| 28 | + ## App server picks up changes |
| 29 | + |
| 30 | + Use `nodemon` (or similar) so that your app server restarts and picks up changes after a rebuild finishes. |
| 31 | + |
| 32 | + For example, you can use `wrangler --watch` for Cloudflare. |
| 33 | + |
| 34 | + Alternatively, you can roll your own with `chokidar` (or similar) if you want to still use the `global` trick to persist in-memory stuff across rebuilds. |
| 35 | + |
| 36 | + ## Configure |
| 37 | + |
| 38 | + To enable the new dev server with all defaults, set the `unstable_dev` future flag to `true`: |
| 39 | + |
| 40 | + ```js |
| 41 | + // remix.config.js |
| 42 | + |
| 43 | + module.exports = { |
| 44 | + future: { |
| 45 | + unstable_dev: true, |
| 46 | + }, |
| 47 | + }; |
| 48 | + ``` |
| 49 | + |
| 50 | + You can also set specific options: |
| 51 | + |
| 52 | + ```js |
| 53 | + // remix.config.js |
| 54 | + |
| 55 | + module.exports = { |
| 56 | + future: { |
| 57 | + unstable_dev: { |
| 58 | + // Port to use for the dev server (i.e. the live reload websocket) |
| 59 | + // Can be overridden by a CLI flag: `remix dev --port 3011` |
| 60 | + // default: finds an empty port and uses that |
| 61 | + port: 3010, |
| 62 | + |
| 63 | + // Port for your running Remix app server |
| 64 | + // Can be overridden by a CLI flag: `remix dev --app-server-port 3021` |
| 65 | + // default: `3000` |
| 66 | + appServerPort: 3020, |
| 67 | + |
| 68 | + // Path to the Remix request handler in your app server |
| 69 | + // Most app server will route all requests to the Remix request handler and will not need to set this option. |
| 70 | + // If your app server _does_ route only certain request paths to the Remix request handler, then you'll need to set this. |
| 71 | + // default: `""` |
| 72 | + remixRequestHandlerPath: "/products", |
| 73 | + |
| 74 | + // Milliseconds between "readiness" pings to your app server |
| 75 | + // When a Remix rebuild finishes, the dev server will ping a special endpoint (`__REMIX_ASSETS_MANIFEST`) |
| 76 | + // to check if your app server is serving up-to-date routes and assets. |
| 77 | + // You can set this option to tune how frequently the dev server polls your app server. |
| 78 | + // default: `50` |
| 79 | + rebuildPollIntervalMs: 25, |
| 80 | + }, |
| 81 | + }, |
| 82 | + }; |
| 83 | + ``` |
| 84 | + |
| 85 | +### Patch Changes |
| 86 | + |
| 87 | +- When running the dev server (current or `unstable_dev`), each rebuild wrote new files to `build/` and `public/build/`. ([#5223](https://github.com/remix-run/remix/pull/5223)) |
| 88 | + Since these files are not removed (unless the dev server crashes or is gracefully terminated), |
| 89 | + thousands of files could accumulate as the dev server ran. |
| 90 | + This causes performance issues and could be confusing. |
| 91 | + |
| 92 | + Now, the dev server also cleans up the build directories whenever a rebuild starts. |
| 93 | + |
| 94 | +- Updated dependencies: |
| 95 | + - `@remix-run/serve@1.12.0-pre.0` |
| 96 | + - `@remix-run/server-runtime@1.12.0-pre.0` |
| 97 | + |
3 | 98 | ## 1.11.1
|
4 | 99 |
|
5 | 100 | ### Patch Changes
|
|
0 commit comments