meteor / babel

Babel wrapper package for use with Meteor
Other
46 stars 20 forks source link

Fix source map generation #17

Closed klaussner closed 7 years ago

klaussner commented 7 years ago

This PR fixes source map generation to resolve one of the debugging issues described in meteor/meteor#8611.

The source maps that are generated by compile are wrong if at least one Babel plugin is included in the options object (see https://github.com/meteor/meteor/issues/8611#issuecomment-313872380). I'm not really sure why the current implementation doesn't work but it looks like it's a problem with Babel's inputSourceMap option. Instead of using an intermediate source map, I think it's fine to transform the AST twice and let Babel generate the source map from the final AST only. Another benefit is that compile doesn't have to generate code twice (once for each pass) anymore.

I have tested this change with a few combinations of Babel plugins and presets and compile always created a correct source map.

benjamn commented 7 years ago

Thanks a ton @klaussner!