Skip to content

Commit 4f2eb9e

Browse files
committed
fix(bug): fixes a bug that could lead to infinite recursion when some runtime babel helpers would transform themselves
1 parent fa7b286 commit 4f2eb9e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/util/path/path-util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export function isBabelHelper(path: string): boolean {
6767
* @returns {boolean}
6868
*/
6969
export function isBabelEsmHelper(path: string): boolean {
70-
return path.startsWith(`${BABEL_RUNTIME_PREFIX_1}helpers/esm`) || path.startsWith(`${BABEL_RUNTIME_PREFIX_2}helpers/esm`);
70+
return path.includes(`${BABEL_RUNTIME_PREFIX_1}helpers/esm`) || path.includes(`${BABEL_RUNTIME_PREFIX_2}helpers/esm`);
7171
}
7272

7373
/**
@@ -76,7 +76,7 @@ export function isBabelEsmHelper(path: string): boolean {
7676
* @returns {boolean}
7777
*/
7878
export function isBabelCjsHelper(path: string): boolean {
79-
return !isBabelEsmHelper(path) && (path.startsWith(`${BABEL_RUNTIME_PREFIX_1}helpers`) || path.startsWith(`${BABEL_RUNTIME_PREFIX_2}helpers`));
79+
return !isBabelEsmHelper(path) && (path.includes(`${BABEL_RUNTIME_PREFIX_1}helpers`) || path.includes(`${BABEL_RUNTIME_PREFIX_2}helpers`));
8080
}
8181

8282
/**

0 commit comments

Comments
 (0)