fix(build): fail on warnings emitted during the generate phase

failOnWarningsPlugin checked the warning count in buildEnd, which runs before
chunk-generation warnings (e.g. INEFFECTIVE_DYNAMIC_IMPORT) are emitted, so
those never failed the build. Move the check to closeBundle, the last hook.

Assisted-by: Claude:Opus-4.8
This commit is contained in:
silverwind
2026-06-29 11:28:14 +02:00
parent 290aaf7363
commit 493a7dd36e

View File

@@ -45,7 +45,7 @@ function failOnWarningsPlugin(): Rolldown.Plugin {
onLog(level) {
if (level === 'warn') warningCount++;
},
buildEnd() {
closeBundle() {
if (!warningCount) return;
throw new Error(`${warningCount} warnings present`);
},