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