mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
CoffeeScript compiler: strip exported variables *before* running through the Babel compiler, to avoid Babel turning a one-line var statement into a multiline var statement and breaking the parsing logic in stripExportedVars
This commit is contained in:
@@ -83,6 +83,11 @@ export class CoffeeCompiler extends CachingCompiler {
|
||||
|
||||
let sourceMap = JSON.parse(output.v3SourceMap);
|
||||
|
||||
output.js = stripExportedVars(
|
||||
output.js,
|
||||
inputFile.getDeclaredExports().map(e => e.name)
|
||||
);
|
||||
|
||||
if (source.indexOf('`') !== -1) {
|
||||
// If source contains backticks, pass the coffee output through babel-compiler
|
||||
const doubleRoastedCoffee =
|
||||
@@ -108,10 +113,7 @@ export class CoffeeCompiler extends CachingCompiler {
|
||||
}
|
||||
}
|
||||
|
||||
return addSharedHeader(stripExportedVars(
|
||||
output.js,
|
||||
inputFile.getDeclaredExports().map(e => e.name)
|
||||
), sourceMap);
|
||||
return addSharedHeader(output.js, sourceMap);
|
||||
}
|
||||
|
||||
addCompileResult(inputFile, sourceWithMap) {
|
||||
|
||||
Reference in New Issue
Block a user