Skip to content
Miniflare
Visit Miniflare on GitHub
Set theme to dark (โ‡ง+D)

๐Ÿ—บ 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.

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. For the error page to correctly resolve your source files, you must set devtoolModuleFilenameTemplate to [absolute-resource-path]:

module.exports = {
entry: "./src/index.js",
devtool: "cheap-module-source-map",
output: {
devtoolModuleFilenameTemplate: "[absolute-resource-path]",
},
};

Rollup

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

TypeScript

Use the --sourceMap flag or the sourceMap option.