Skip to content

remix/node-hmr/runtime · Variable

View Source

createBrowserHmrChannel

Summary

Connects browser asset tooling in this child process to the browser HMR event stream and file watcher owned by its node-hmr parent process.

Pass this function as the hmr factory for createAssetServer(). Each call creates an independent channel that must be closed when its owner shuts down. The returned promise rejects when browser HMR is disabled for the runner.

The remix/node-hmr/runtime module itself can only be imported by a process supervised by node-hmr. Use a dynamic import guarded by process.env.REMIX_NODE_HMR when the same entry module also runs without HMR supervision.

Signature

const createBrowserHmrChannel: NodeHmrRuntimeApi["createBrowserHmrChannel"]