mirror of
https://github.com/haexhub/haex-hub.git
synced 2025-12-17 06:30:50 +01:00
Fix production build crash by resolving circular import dependency
Moved database schemas from src-tauri/database/schemas/ to src/database/schemas/ to fix bundling issues and resolved circular import dependency that caused "Cannot access uninitialized variable" error in production builds. Key changes: - Moved crdtColumnNames definition into haex.ts to break circular dependency - Restored .$defaultFn(() => crypto.randomUUID()) calls - Kept AnySQLiteColumn type annotations - Removed obsolete TDZ fix script (no longer needed) - Updated all import paths across stores and configuration files
This commit is contained in:
@ -1,52 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Post-build script to fix the Vite 7.x TDZ error in __vite__mapDeps
|
||||
* This script patches the generated JavaScript files after the build
|
||||
*/
|
||||
|
||||
import { readdir, readFile, writeFile } from 'node:fs/promises'
|
||||
import { join } from 'node:path'
|
||||
|
||||
const NUXT_DIR = join(process.cwd(), '.output/public/_nuxt')
|
||||
|
||||
async function fixFile(filePath) {
|
||||
const content = await readFile(filePath, 'utf-8')
|
||||
const fixedContent = content.replace(
|
||||
/const __vite__mapDeps=\(i,m=__vite__mapDeps,/g,
|
||||
'let __vite__mapDeps;__vite__mapDeps=(i,m=__vite__mapDeps,'
|
||||
)
|
||||
|
||||
if (fixedContent !== content) {
|
||||
await writeFile(filePath, fixedContent, 'utf-8')
|
||||
console.log(`✓ Fixed TDZ error in ${filePath.split('/').pop()}`)
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
async function main() {
|
||||
try {
|
||||
const files = await readdir(NUXT_DIR)
|
||||
const jsFiles = files.filter((f) => f.endsWith('.js'))
|
||||
|
||||
let fixedCount = 0
|
||||
for (const file of jsFiles) {
|
||||
const filePath = join(NUXT_DIR, file)
|
||||
const fixed = await fixFile(filePath)
|
||||
if (fixed) fixedCount++
|
||||
}
|
||||
|
||||
if (fixedCount > 0) {
|
||||
console.log(`\n✓ Fixed __vite__mapDeps TDZ error in ${fixedCount} file(s)`)
|
||||
} else {
|
||||
console.log('\n✓ No __vite__mapDeps TDZ errors found')
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fixing __vite__mapDeps:', error)
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
main()
|
||||
Reference in New Issue
Block a user