-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The new dev server #5133
The new dev server #5133
Conversation
🦋 Changeset detectedLatest commit: 86eb50e The changes in this PR will be included in the next version bump. This PR includes changesets to release 17 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
15c32da
to
630245b
Compare
630245b
to
47258a8
Compare
🤖 Hello there, We just published version Thanks! |
@pcattori I just tried the new dev server, and it doesn't appear to be working for me. Perhaps I misunderstood what it's supposed to do. Here's my config module.exports = {
ignoredRouteFiles: ["**/.*"],
future: {
unstable_dev: {
appServerPort: 3000,
},
},
}; I ran ❯ npx remix dev
starting new dev server
devServer2.serve
starting livereload on port 3001...
starting watch...
💿 Built in 349ms
ending watch... ❯ npx remix-serve build
Remix App Server started at http://localhost:3000 Anyway, it looks like it simply returns from |
@kiliman thanks for trying it out! I just merged a couple fixes and improvements a couple hours ago (#5137) that should fix this for you. Also the expectation is that your app server is running behind |
* refactor(dev): builds return the updated assets manifest * refactor(dev): inject live reload port during build * feat(dev): new dev server via future flag * test(dev): update tests for new dev server * Create mean-clocks-bow.md
Approach
Running the new dev server does the following:
server.js
) to be readyRELOAD
message over the websocketFor step (3), the dev server polls
GET <app server>/__REMIX_ASSETS_MANIFEST
and compares the build hash received from the app server with the latest build hash produced by the compiler run within the dev server.Benefits
1 No more require cache purge
App server is now only restarted when a rebuild happens, not on every request.
That means that in-memory persistence is fixed. So no need to use the
global
trick anymore when dealing with DB connections, in-memory caches, etc..In fact app server might not need to restart at all if the app server supports some sort of server-side HMR.
2 Supports any app server
Previously, dev mode only worked for
@remix-run/serve
, not for custom servers likeserver.{js,ts}
.Now any custom server is compatible with the new dev server.
3 Support ESM mode for Node server?
Previously, we needed fine-grain control of the require cache, which prevented Remix servers from being run in ESM mode.
Since the new dev server does not need to purge the require cache at all, this limitation has been removed.
I think this means we could support ESM-mode Remix servers now if we wanted to.
Future work
build/index.js
./build/index.js
manually.ts-node ./server.js
TODO
Closes: #
Testing Strategy: