Skip to content

Latest commit

History

History
48 lines (35 loc) 路 1.22 KB

source-maps.md

File metadata and controls

48 lines (35 loc) 路 1.22 KB
order
1

馃椇 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.