Skip to content
Merged
16 changes: 16 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,26 @@ const webComponents = new Set([
'text-expander',
]);

function failOnWarningsPlugin(): Rolldown.Plugin {
let warningCount = 0;
return {
name: 'fail-on-warnings',
onLog(level) {
if (level === 'warn') warningCount++;
},
buildEnd() {
if (!warningCount) return;
console.error(`\nerror: ${warningCount} warnings present`);
Comment thread
silverwind marked this conversation as resolved.
Outdated
process.exit(1);
Comment thread
silverwind marked this conversation as resolved.
Outdated
},
};
}

const commonRolldownOptions: Rolldown.RolldownOptions = {
checks: {
pluginTimings: false,
},
...(env.CI ? {plugins: [failOnWarningsPlugin()]} : {}),
};

function commonViteOpts({build, ...other}: InlineConfig): InlineConfig {
Expand Down