Skip to content

Commit

Permalink
Pass filename instead of sourceFilename to the babylon/babel parsers …
Browse files Browse the repository at this point in the history
…as that's the field that's passed through to plugins
  • Loading branch information
rpetrich committed Jul 20, 2019
1 parent 6284017 commit 6f3a672
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions async-to-promises.ts
Expand Up @@ -2917,20 +2917,17 @@ export default function({ types, template, traverse, transformFromAst, version }
}
} as Visitor
}];
const helperAst = require(isNewBabel ? "@babel/core" : "babylon").parse(helperCode, {
sourceType: "module",
filename: "helpers.js",
});
if (isNewBabel) {
const helperAst = require("@babel/core").parse(helperCode, {
sourceType: "module"
});
transformFromAst(helperAst, helperCode, {
babelrc: false,
configFile: false,
plugins,
});
} else {
const helperAst = require("babylon").parse(helperCode, {
sourceType: "module",
sourceFilename: "helpers.js"
});
transformFromAst(helperAst, helperCode, {
babelrc: false,
plugins,
Expand Down

0 comments on commit 6f3a672

Please sign in to comment.