Skip to content

remix/ui-hmr · Function

View Source

transformComponentsForBrowser

Summary

Rewrites a browser Remix UI module to preserve compatible component instances across HMR updates.

The transform instruments supported component and client-entry exports, registers their latest implementations with the browser runtime, and injects an import.meta.hot accept boundary. If parsing fails, no supported exports are found, or the module cannot be updated safely as a whole, the source is returned unchanged with transformed: false.

Signature

function transformComponentsForBrowser(
  source: string,
  options: BrowserComponentsHmrTransformOptions,
): ComponentsHmrTransformResult

Parameters

source

Component module source code.

options

Browser transform options.

Returns

Rewritten source, discovered component names, and an optional source map.