Deployments

Source Maps

Production client source maps are disabled by default. Keep that default unless your error reporting workflow needs browser stack trace symbolication.

Hidden upload-only maps

Use hidden maps when a service such as Sentry should receive maps but visitors should not discover them through the client manifest or sourceMappingURL comments.

import { dirname } from "node:path";
import { fileURLToPath } from "node:url";

const projectRoot = dirname(fileURLToPath(import.meta.url));

mreactRouter({
  projectRoot,
  routesDir: "src/app",
  clientSourceMaps: "hidden",
});
mreact-router build --client-source-maps=hidden

Hidden maps are written under .mreact/source-maps/client/. Upload those files during CI after mreact-router build, then deploy .mreact/client without the hidden map directory.

Sentry-style upload flow

  1. Choose a release identifier before the build, for example the Git commit SHA.
  2. Build with clientSourceMaps: "hidden" or mreact-router build --client-source-maps=hidden.
  3. Upload .mreact/source-maps/client/**/*.map to Sentry or another symbolication service using the same release identifier.
  4. Deploy server output and .mreact/client.
  5. Do not copy .mreact/source-maps to the public static asset host.

Use the same release identifier in server logs and client error events so uploaded maps can be matched to minified stack traces.

Linked maps

Use clientSourceMaps: "linked" only for debugging environments where public .js.map files are acceptable. Linked maps are discoverable by visitors because JavaScript files include public source map references.