🗺 Source Maps

Source maps allow error stack traces to include the actual location in the source an error occurred, as opposed to somewhere in the bundled output. See this page for more details.

Enabling Source Map Support

When using the CLI, source map support is always enabled automatically. 🎉

When using the API, source map support can be enabled with the sourceMap option. Note this will install support globally in your entire application:

const mf = new Miniflare({
  sourceMap: true,
});

Outputting Source Maps

How you generate source maps depends on your build tool. Here's how to do it for some popular tools:

esbuild

Use the --sourcemap flag or the sourcemap option.

Webpack

See the devtool configuration option. Note that eval is unsupported in workers.

Rollup

Use the --sourcemap flag or the output.sourcemap option.

TypeScript

Use the --sourceMap flag or the sourceMap option.