Skip to content

Commit

Permalink
Run asset compilation in series (e.g. prevents Rollup conflicts)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Sep 12, 2023
1 parent 16e874b commit 8f74d02
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
12 changes: 3 additions & 9 deletions shared/tasks/scripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,10 @@ export async function compile(pattern, options) {
cwd: options.srcPath
})

// Increase Node.js max listeners warning threshold to silence
// Rollup calling `process.on('warning')` once per bundle
process.setMaxListeners(1 + modulePaths.length)

try {
const compileTasks = modulePaths.map((modulePath) =>
compileJavaScript([modulePath, options])
)

await Promise.all(compileTasks)
for (const modulePath of modulePaths) {
await compileJavaScript([modulePath, options])
}
} catch (cause) {
throw new PluginError('shared/tasks/scripts', cause)
}
Expand Down
6 changes: 2 additions & 4 deletions shared/tasks/styles.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ export async function compile(pattern, options) {
})

try {
const compileTasks = modulePaths.map((modulePath) =>
for (const modulePath of modulePaths) {
compileStylesheet([modulePath, options])
)

await Promise.all(compileTasks)
}
} catch (cause) {
throw new PluginError('shared/tasks/styles', cause)
}
Expand Down

0 comments on commit 8f74d02

Please sign in to comment.