gobblejs / gobble

The last build tool you'll ever need

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Better sourcemap source resolution

Rich-Harris opened this issue · comments

A sourcemap source is the first file that doesn't have an associated sourcemap, but that means that if you have a build like this...

module.exports = gobble( 'src' )
  .grab( 'js' )
  .exclude( 'whatever.js' )
  .transform( 'babel' );

...then as far as babel is concerned, the source files are .gobble/02-exclude/[files].js. So that's what shows up in the sources pane in-browser.

Since gobble now owns the sourcemap pipeline, it'd be nice to fix those so that the correct sources are revealed, at least on a best effort basis. On OS X it would be easy enough to just trace the symlinks back to their origin (since in the majority of cases, they will be symlinks to files in an original source dir), but that doesn't work on Windows where symlinks can't be used. So it might take a slightly more sophisticated approach. Perhaps if we store checksums of all the source files, then we can read any sources in the final sourcemaps that live inside .gobble, find their checksums, and match them up.