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

Make source map output more configurable #1311

Open
jmm opened this issue Jun 25, 2015 · 1 comment
Open

Make source map output more configurable #1311

jmm opened this issue Jun 25, 2015 · 1 comment

Comments

@jmm
Copy link
Collaborator

jmm commented Jun 25, 2015

I think it makes sense to make the source map output more configurable and I want to talk about how to expose that. I know @zertosh has already expressed support for exposing sourceRoot.

I think some kind of namespacing makes sense for clarity and consistency. For example, while it might not be awful to expose sourceRoot via an opts.sourceRoot option, it makes little sense to expose file via an opts.file option, and I think it'd be ugly to end up with something inconsistent like opts.sourceRoot and opts.sourceMapFile.

Here are what seem like the most sensible ideas to me:

  1. sourceMap prefix, e.g. sourceMapSourceRoot, sourceMapFile.
    Pros: Pretty self explanatory, simple to implement.
    Cons: Fairly verbose.
  2. sm prefix, e.g. smSourceRoot, smFile.
    Pros: Simple to implement, compact.
    Cons: Less self-explanatory, but easily explained via documentation.
  3. opts.sourceMap hash, e.g. sourceMap: {sourceRoot: '...', file: '...'} (overwrite all defaults), and deep property merging (selectively overwrite defaults), e.g. 'sourceMap.sourceRoot': '...'.
    Pros: All source map config contained in single object instead of a bunch of separate properties, ability to overwrite all defaults just by passing an object as opts.sourceMap.
    Cons: More complicated implementation, need to quote keys to selectively overwrite properties, fairly verbose.

See also: #1304, #1233.

I'm also interested in the idea of allowing the user to pass in a function to manipulate the source map before it's written.

@intentionally-left-nil
Copy link

I just spent the evening working around this after-the-fact on my own. Not a whole lot of fun.

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

No branches or pull requests

2 participants