feat(build): add comprehensive ESBuild error handling to Vite configurations

- Add ESBuild logLevel: 'error' to all Vite configs
- Configure logOverride for critical errors: duplicate-export, duplicate-member, syntax-error, invalid-identifier
- Ensure builds fail immediately on ESBuild compilation errors
- Apply to common, web, and optimized Vite configurations

Prevents broken code from being deployed due to build-time errors
This commit is contained in:
Matthew Raymer
2025-08-20 02:29:09 +00:00
parent 618b822c8b
commit 8386804bbd
4 changed files with 56 additions and 2 deletions

View File

@@ -6,7 +6,6 @@ import path from "path";
import { fileURLToPath } from 'url';
// Load environment variables
console.log('NODE_ENV:', process.env.NODE_ENV)
dotenv.config({ path: `.env.${process.env.NODE_ENV}` })
@@ -53,6 +52,22 @@ export async function createBuildConfig(platform: string): Promise<UserConfig> {
format: 'es',
plugins: () => []
},
// ESBuild configuration to fail on errors
esbuild: {
target: 'es2015',
supported: {
'bigint': true
},
// Fail on any ESBuild errors
logLevel: 'error',
// Ensure build fails on syntax errors and other critical issues
logOverride: {
'duplicate-export': 'error',
'duplicate-member': 'error',
'syntax-error': 'error',
'invalid-identifier': 'error'
}
},
define: {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),