mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Protect against missing Babel source maps in compile-coffeescript.js.
This commit is contained in:
@@ -83,12 +83,19 @@ export class CoffeeCompiler extends CachingCompiler {
|
||||
doubleRoastedCoffee.data != null) {
|
||||
output.js = doubleRoastedCoffee.data;
|
||||
|
||||
// Combine the original CoffeeScript source map with the one
|
||||
// produced by this.babelCompiler.processOneFileForTarget.
|
||||
const smg = new SourceMapGenerator(
|
||||
new SourceMapConsumer(doubleRoastedCoffee.sourceMap));
|
||||
smg.applySourceMap(new SourceMapConsumer(sourceMap));
|
||||
sourceMap = smg.toJSON();
|
||||
if (doubleRoastedCoffee.sourceMap) {
|
||||
// Combine the original CoffeeScript source map with the one
|
||||
// produced by this.babelCompiler.processOneFileForTarget.
|
||||
const smg = new SourceMapGenerator(
|
||||
new SourceMapConsumer(doubleRoastedCoffee.sourceMap));
|
||||
smg.applySourceMap(new SourceMapConsumer(sourceMap));
|
||||
sourceMap = smg.toJSON();
|
||||
} else {
|
||||
// If the .coffee file is contained by a node_modules directory,
|
||||
// then BabelCompiler will not transpile it, and there will be
|
||||
// no sourceMap, but that's fine because the original
|
||||
// CoffeeScript sourceMap will still be valid.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user