Skip to content

Commit d0b5159

Browse files
committed
fix(building-rollup): add transitive babel helper dependencies
1 parent ba1ee2d commit d0b5159

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

packages/building-rollup/src/babel/rollup-plugin-bundled-babel-helpers.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,27 @@ function getHelperImportSpecifier(ast, format) {
5050
}
5151
}
5252

53+
function addHelperDependencies(allHelpers, helper) {
54+
if (helper === 'regeneratorRuntime') {
55+
return;
56+
}
57+
58+
for (const dep of getDependencies(helper)) {
59+
if (!allHelpers.has(dep)) {
60+
allHelpers.add(dep);
61+
addHelperDependencies(allHelpers, dep);
62+
}
63+
}
64+
}
65+
5366
function getHelpersWithDependencies(helpers) {
5467
const all = new Set(helpers);
5568
for (const helper of helpers) {
56-
if (helper !== 'regeneratorRuntime') {
57-
for (const d of getDependencies(helper)) {
58-
all.add(d);
59-
}
60-
}
69+
addHelperDependencies(all, helper);
6170
}
6271
return Array.from(all);
6372
}
73+
6474
function createHelperModule(helpers, format, minify) {
6575
const helpersWithDependencies = getHelpersWithDependencies(helpers);
6676
const addRegeneratorRuntime = helpersWithDependencies.includes('regeneratorRuntime');

0 commit comments

Comments
 (0)