Repository navigation
cli v1.0.4
Patch Changes
-
Declare Bun 1.4.3 as the minimum supported Bun version in
engines. Upgrade Bun to 1.4.3 or later before updating if you run Remix on Bun. (#12367) -
The bundled Remix agent skill in
remix newapps now includes guidance for translating modern web-platform patterns into idiomatic Remix and recommends pairing with Google Chrome's Modern Web Guidance skill. (#12418) -
Apps created with
remix newnow keep the starter welcome page SVGs inpublic/remix-wordmark.svgandpublic/welcome-icons.svginstead of inlining them inapp/actions/home-page.tsxandapp/actions/public/prompt-button.tsx, and simplify the starter CSS andPromptButtoncomponent. The generatedAGENTS.mdalso notes which starter files are safe to replace and summarizes theclientEntryinteractive component model. (#12478) -
New apps created with
remix newreport HMR port conflicts without starting the app server, avoiding a secondaryEPIPEerror from the child process. Existing apps can apply the same startup and shutdown changes inhmr.ts: (#12472)--- a/hmr.ts +++ b/hmr.ts @@ -1 +1,2 @@ +import { once } from 'node:events' import * as http from 'node:http' @@ -12,35 +13,47 @@ -const hmrRunner = run('server.ts', { - env: { - ...process.env, - PORT: String(appPort), - HMR_PROXY_PORT: String(hmrProxyPort), - }, - nodeArgs: ['--import', 'remix/node-tsx', '--import', 'remix/component-hmr/node'], - browserHmrChannel: { port: hmrEventPort }, -}) - -const server = http.createServer( - createRequestListener( - createHmrReadyFetch( - hmrRunner, - createFetchProxy(`http://127.0.0.1:${appPort}`, { - xForwardedHeaders: true, - }), - ), - ), -) - -server.listen(hmrProxyPort, '127.0.0.1') +const server = http.createServer() let shuttingDown = false +let hmrRunner: ReturnType<typeof run> | undefined -function shutdown() { +process.on('SIGINT', () => shutdown()) +process.on('SIGTERM', () => shutdown()) + +try { + server.listen(hmrProxyPort, '127.0.0.1') + await once(server, 'listening') + + if (!shuttingDown) { + hmrRunner = run('server.ts', { + env: { + ...process.env, + PORT: String(appPort), + HMR_PROXY_PORT: String(hmrProxyPort), + }, + nodeArgs: ['--import', 'remix/node-tsx', '--import', 'remix/component-hmr/node'], + browserHmrChannel: { port: hmrEventPort }, + }) + + server.on( + 'request', + createRequestListener( + createHmrReadyFetch( + hmrRunner, + createFetchProxy(`http://127.0.0.1:${appPort}`, { + xForwardedHeaders: true, + }), + ), + ), + ) + } +} catch (error) { + console.error(`Failed to start HMR on http://127.0.0.1:${hmrProxyPort}:`, error) + shutdown(1) +} + +function shutdown(exitCode = 0) { if (shuttingDown) return shuttingDown = true - server.close(() => hmrRunner.close().finally(() => process.exit(0))) + server.close(() => Promise.resolve(hmrRunner?.close()).finally(() => process.exit(exitCode))) server.closeAllConnections() } - -process.on('SIGINT', shutdown) -process.on('SIGTERM', shutdown)
-
Apps created with
remix newnow start their Node.js server withserve()fromremix/node-fetch-server. Outside development, shutdown onSIGINTorSIGTERMcloses idle and speculative connections immediately while allowing active requests up to 30 seconds to finish before force-closing remaining connections and closing the asset server; development shutdown continues to close connections immediately. (#12494) -
Bumped
@remix-run/*dependencies: