Skip to content

Conversation

@Dvvarf
Copy link

@Dvvarf Dvvarf commented Apr 5, 2021

As stated in title, this patch adds ability to generate maps for merged files. Not after concatenation, but before. Turns out there is even an issue that could be fixed by this PR: #35.

How to use:

  1. Add sourceMap property to MergeIntoFile constructor's options. sourceMap can be a boolean or object with these properties, both optional:
    sourceRoot (string - root path to map merged files against),
    inlineSources (boolean - set to true to include source files into map files).
  2. Use callback in files array that should look like this in the simplest case:
(code, map) => ({
  "file.js": code,
  "file.js.map": map.toString(),
})

In this callback map is an instance of SourceMapGenerator. It can be passed further to Terser or processed in any other way you'd like.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant