Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to generate maps for merged files #65

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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