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 sourceMapIn option #827

Closed
bryanburgers opened this Issue Feb 18, 2015 · 6 comments

Comments

Projects
None yet
3 participants
@bryanburgers
Copy link

bryanburgers commented Feb 18, 2015

babel/grunt-babel#14 suggests using grunt-contrib-concat to concatenate multiple files before compiling with Babel.

However, then the outputted source maps reference the file that was created by concat, not the original files. It would be awesome if Babel could take in an existing source map while it does its transforms, so that the outputted source maps reference the original files rather than an intermediate file.

  • Many CSS-processor libraries deal with this by looking in a standard place for a map file (when loading style.css, look for original source maps at style.css.map).
  • Uglify deals with this using a sourceMapIn option.
@kittens

This comment has been minimized.

Copy link
Contributor

kittens commented Mar 6, 2015

Available as of 4.7.0, thanks! You can either set the inputSourceMap option with a source map object or it'll look for a source map comment in the input file.

@bryanburgers

This comment has been minimized.

Copy link
Author

bryanburgers commented Mar 7, 2015

Yay! Thank you so much.

@Rich-Harris

This comment has been minimized.

Copy link
Contributor

Rich-Harris commented Mar 12, 2015

Is it possible to disable this option? For some reason I'm getting wonky sourcemaps as a result and I've had to downgrade to 4.6.6 (the sourcemap generated by babel references files that don't exist - the bug is probably something external to babel, and if not I'll raise an issue if I can track it down).

Because I typically have transformations after babel in any case (bundling, minification etc) I prefer to merge sourcemaps as a single step at the end of the build. If I comment out these lines everything works okay again.

kittens pushed a commit that referenced this issue Mar 13, 2015

Sebastian McKenzie
@kittens

This comment has been minimized.

Copy link
Contributor

kittens commented Mar 13, 2015

@Rich-Harris Attached commit should do the trick. If you set inputSourceMap to false it wont try and find the sourcemap comment. I'll push out a new release in a bit.

@kittens

This comment has been minimized.

Copy link
Contributor

kittens commented Mar 13, 2015

@Rich-Harris Available as of 4.7.9, let me know if it works.

@Rich-Harris

This comment has been minimized.

Copy link
Contributor

Rich-Harris commented Mar 13, 2015

@sebmck Thanks for the rapid response as ever, though I think the condition is the wrong way round? Installing 4.7.9 fixed our issue but we didn't expect it to! Adding inputSourceMap: false caused the bug to reappear. PR inbound

Rich-Harris added a commit to Rich-Harris/babel that referenced this issue Mar 13, 2015

fix inputSourceMap option
See babel#827 - it looks like `opts.inputSourceMap` is the wrong way round, babel should only use an input sourcemap if the `inputSourceMap` option is *not* `false`

@lock lock bot added the outdated label Jul 25, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Jul 25, 2018

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