Skip to content

Commit

Permalink
Fix @babel/core@7.0.0 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Mar 9, 2022
1 parent d1c7ee5 commit 2b2f58a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion packages/babel-helpers/src/index.ts
Expand Up @@ -271,7 +271,19 @@ function loadHelper(name: string) {
const fn = (): File => {
if (!process.env.BABEL_8_BREAKING) {
if (!FileClass) {
return { ast: file(helper.ast()) } as File;
const fakeFile = {
ast: file(helper.ast()),
code: "[internal Babel helper code]",
path: null,
inputMap: null,
} as File;
traverse(fakeFile.ast, {
Program(path) {
fakeFile.path = path;
path.stop();
},
});
return fakeFile;
}
}
return new FileClass(
Expand Down

0 comments on commit 2b2f58a

Please sign in to comment.