Skip to content

Commit cb651ad

Browse files
committed
Run library build one at a time to avoid OOM on Netlify
1 parent 224b4b8 commit cb651ad

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"lint": "eslint . --ext ts,tsx,js,jsx --rulesdir=packages/webamp-modern/tools/eslint-rules",
1717
"type-check": "pnpm --filter webamp type-check && pnpm --filter ani-cursor type-check && pnpm --filter skin-database type-check && pnpm --filter webamp-docs type-check && pnpm --filter winamp-eqf type-check",
1818
"deploy": "npx turbo webamp#build webamp-modern#build --concurrency 1 && mv packages/webamp-modern/build packages/webamp/dist/demo-site/modern",
19+
"deploy-docs": "npx turbo webamp-docs#build",
1920
"format": "prettier --write '**/*.{js,ts,tsx}'"
2021
},
2122
"devDependencies": {

packages/webamp/scripts/rollup.mjs

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,32 @@ const BUNDLES = [
8888
},
8989
];
9090

91+
const PARALLEL_LIMIT = 1;
92+
9193
build();
9294

9395
async function build() {
94-
console.log(`🚀 Building ${BUNDLES.length} bundles in parallel...`);
96+
console.log(
97+
`🚀 Building ${BUNDLES.length} bundles in parallel (limit: ${PARALLEL_LIMIT})...`
98+
);
99+
100+
let index = 0;
101+
async function nextBatch() {
102+
const batch = [];
103+
for (
104+
let i = 0;
105+
i < PARALLEL_LIMIT && index < BUNDLES.length;
106+
i++, index++
107+
) {
108+
batch.push(runBundle(BUNDLES[index]));
109+
}
110+
await Promise.all(batch);
111+
if (index < BUNDLES.length) {
112+
await nextBatch();
113+
}
114+
}
95115

96-
const buildPromises = BUNDLES.map(async (bundleDesc) => {
116+
async function runBundle(bundleDesc) {
97117
console.log(`📦 Building ${bundleDesc.name}...`);
98118
const plugins = getPlugins({
99119
outputFile: bundleDesc.output.file,
@@ -136,8 +156,8 @@ async function build() {
136156
...bundleDesc.output,
137157
});
138158
console.log(`✅ Completed ${bundleDesc.name}`);
139-
});
159+
}
140160

141-
await Promise.all(buildPromises);
161+
await nextBatch();
142162
console.log(`🎉 All ${BUNDLES.length} bundles built successfully!`);
143163
}

0 commit comments

Comments
 (0)