Router guards: - apps/app: added DEV-gated logging matching admin pattern (route info, auth decisions, org selection, access granted/denied) - apps/portal: added DEV-gated logging matching admin pattern (route info, auth decisions, backward-compat redirects) - apps/admin: already had full logging (unchanged) Ungated console statements fixed: - admin/main.ts: error handler, plugin registration, mount errors - admin/pages/login.vue, register.vue: catch block errors - admin/pages/events/index.vue: fetch error logging - admin/pages/wizard-examples: demo form submit logging - admin/pages/faq.vue: catch block error All console statements in Crewli-authored code are now gated behind import.meta.env.DEV — zero console output in production builds. Vuexy template demo files (views/demos/*) left as-is. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
53 lines
1.6 KiB
TypeScript
53 lines
1.6 KiB
TypeScript
import { createApp } from 'vue'
|
|
import { VueQueryPlugin } from '@tanstack/vue-query'
|
|
import { queryClientConfig } from '@/lib/query-client'
|
|
|
|
import App from '@/App.vue'
|
|
import { registerPlugins } from '@core/utils/plugins'
|
|
|
|
// Styles
|
|
import '@core/scss/template/index.scss'
|
|
import '@styles/styles.scss'
|
|
|
|
// Create vue app
|
|
const app = createApp(App)
|
|
|
|
// Error handler for unhandled errors
|
|
app.config.errorHandler = (err, instance, info) => {
|
|
if (import.meta.env.DEV) {
|
|
console.error('Vue Error:', err, info)
|
|
console.error('Component:', instance)
|
|
}
|
|
}
|
|
|
|
// Register plugins
|
|
app.use(VueQueryPlugin, queryClientConfig)
|
|
|
|
try {
|
|
registerPlugins(app)
|
|
} catch (error) {
|
|
if (import.meta.env.DEV) console.error('Failed to register plugins:', error)
|
|
throw error
|
|
}
|
|
|
|
// Mount vue app
|
|
try {
|
|
app.mount('#app')
|
|
} catch (error) {
|
|
if (import.meta.env.DEV) console.error('Failed to mount app:', error)
|
|
// Show error message to user (safe DOM construction — no innerHTML with variables)
|
|
const el = document.getElementById('app')!
|
|
el.innerHTML = ''
|
|
const wrapper = document.createElement('div')
|
|
wrapper.style.cssText = 'padding: 20px; text-align: center;'
|
|
const h1 = document.createElement('h1')
|
|
h1.textContent = 'Application Error'
|
|
const p = document.createElement('p')
|
|
p.textContent = 'Failed to start the application. Please check the console for details.'
|
|
const pre = document.createElement('pre')
|
|
pre.style.cssText = 'text-align: left; background: #f5f5f5; padding: 10px; border-radius: 4px; overflow: auto;'
|
|
pre.textContent = String(error)
|
|
wrapper.append(h1, p, pre)
|
|
el.appendChild(wrapper)
|
|
}
|