From 51439df9ff19d031ebfe87b3077feea70f8e8a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Ribaudo?= Date: Thu, 10 Mar 2022 00:44:49 +0100 Subject: [PATCH] Fix `@babel/core@7.0.0` compatibility --- packages/babel-helpers/src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/babel-helpers/src/index.ts b/packages/babel-helpers/src/index.ts index 5a422f226374..cf8c3c28601e 100644 --- a/packages/babel-helpers/src/index.ts +++ b/packages/babel-helpers/src/index.ts @@ -271,7 +271,11 @@ 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()), path: null } as File; + traverse(fakeFile.ast, { + Program: path => (fakeFile.path = path).stop(), + }); + return fakeFile; } } return new FileClass(