Skip to content

Keep source map generation simple #423

@lydell

Description

@lydell

--source-map, --source-map-root, --source-map-url, --source-map-include-sources, --in-source-map ... come on, I just want my friggin’ source map! ;)

Why not simplify it?

  • Have a --map option to toggle source map generation.
  • Always call it <outputfile>.map and put it next to the output file. (Write it to stderr if writing the output to stdout uglifyjs ... > out.js 2> out.js.map). I don’t see any reason at all to put it anywhere else.
  • Always add sourceContent for every source file. This way you don’t need to worry about hosting the exact version of the source code that produced the generated code. (Host your repo instead.)
  • Never set sourceRoot. We don’t need to if all sources are inlined into the map.
  • Look for sourceMappingURLs in each source file, and apply those source maps automatically.

This makes it super simple, and really nice—both in development and in production.

brunch works like this. I haven’t seen a single request there about generating different source maps.

Is this just me (and the brunch community), or am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions