Skip to content

Commit

Permalink
Log formatted warnings from Rollup
Browse files Browse the repository at this point in the history
  • Loading branch information
colinrotherham committed Oct 5, 2023
1 parent ba4a654 commit 5650b73
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions shared/tasks/scripts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ export async function compileJavaScript([

// Create Rollup bundle(s)
for (const options of config.options) {
const bundle = await rollup({
...options,
const bundle = await rollup(options)

// Handle warnings as errors
onwarn(message) {
throw message
}
})
// Log warnings
config.warnings.flush()

// Handle warnings as errors
if (config.warnings.warningOccurred) {
throw new Error(`Rollup input '${modulePath}' logged warnings`)
}

// Compile JavaScript to output format
await Promise.all(
Expand Down

0 comments on commit 5650b73

Please sign in to comment.