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

Flatten sourcemap chains automatically? #22

Closed
Rich-Harris opened this issue Nov 28, 2014 · 3 comments
Closed

Flatten sourcemap chains automatically? #22

Rich-Harris opened this issue Nov 28, 2014 · 3 comments

Comments

@Rich-Harris
Copy link
Contributor

If you have multiple transformations that each generate sourcemaps...

node = gobble( 'src/coffee' )
  .transform( 'coffee' )
  .transform( 'concat' ) // this plugin doesn't actually generate sourcemaps... yet
  .transform( 'uglify' );

...then the sourcemap that gets generated by the uglify plugin only refers to the output of the concat step, rather than the original CoffeeScript. You can (in theory, it hasn't been widely battle-tested yet) fix this with gobble-sorcery...

node = gobble( 'src/coffee' )
  .transform( 'coffee' )
  .transform( 'concat' )
  .transform( 'uglify' )
  .transform( 'sorcery' );

...but that's kind of a nuisance, and goes against the 'Sourcemaps Just Work' aspiration. Am wondering whether the equivalent transformation should happen automatically. The worst that can happen (again, in theory...) is that a few milliseconds are wasted on a) redundant transformations, or b) transformations that the user doesn't take advantage of, for whatever reason.

Haven't made up my mind yet so will just leave this here.

@bathos
Copy link

bathos commented Apr 7, 2015

Automatic makes sense to me -- I think Gobble in particular, with the exposed build steps and usable console output, can justify being opinionated about this since it fits in neatly with its ethos. Especially if you take into account that the maps are used by Gobble itself for error reporting, which is a secret feature for those of us who don't usually bother with sourcemaps (I didn't know until a few minutes ago, browsing these issues).

@Rich-Harris
Copy link
Contributor Author

@bathos Thanks, I think I agree. A few times I've had a sourcemap-generating step somewhere in the build pipeline and not bothered flattening sourcemaps, and I end up getting HTTP requests for /my/folder/structure/project/.gobble/04-whatever/5/app.js.04-xyz.map or whatever, which is a lousy experience even if you know what's going on. Would be great to just remove sourcemap configuration from the list of things people have to worry about. Slight performance overhead involved in some cases, but that can probably be massaged away to some extent. Will try and work this in shortly.

@Rich-Harris
Copy link
Contributor Author

This is now released, in gobble 0.8.0.

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

No branches or pull requests

2 participants