7970bcc0fd
- Add Pinia auth store, types, and auth service (mocked) - Add login/register/verify/forgot password views and dashboard - Add reusable auth UI components (card, inputs, buttons) - Add router guards and protected routing wiring - Disable vue devtools plugin by default to avoid Node localStorage crash - Update dependencies for cookie handling - Comment out Umami script in index.html Made-with: Cursor
65 lines
1.9 KiB
TypeScript
65 lines
1.9 KiB
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig(async ({ command }) => {
|
|
// `vite-plugin-vue-devtools` (via @vue/devtools-kit) can access `localStorage`
|
|
// at import time, which crashes when Vite loads this config in Node.
|
|
// Load it lazily and only for the dev server.
|
|
const plugins = [vue()]
|
|
|
|
// Opt-in only: enable by running `VITE_VUE_DEVTOOLS=true npm run dev`
|
|
// This avoids Node-side crashes when loading the Vite config.
|
|
if (command === 'serve' && process.env.VITE_VUE_DEVTOOLS === 'true') {
|
|
const { default: vueDevTools } = await import('vite-plugin-vue-devtools')
|
|
plugins.push(vueDevTools())
|
|
}
|
|
|
|
return {
|
|
plugins,
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
},
|
|
},
|
|
build: {
|
|
// Optimize for SEO and performance
|
|
cssCodeSplit: true,
|
|
minify: 'terser',
|
|
terserOptions: {
|
|
compress: {
|
|
drop_console: true,
|
|
drop_debugger: true
|
|
}
|
|
},
|
|
rollupOptions: {
|
|
output: {
|
|
// Optimize chunk splitting for better caching
|
|
manualChunks: {
|
|
'vue-vendor': ['vue', 'vue-router'],
|
|
'ui-components': [
|
|
'./src/components/ProjectCard.vue',
|
|
'./src/components/TechBadge.vue',
|
|
'./src/components/ContactMethod.vue'
|
|
]
|
|
},
|
|
// Use content hash for better caching
|
|
chunkFileNames: 'assets/js/[name]-[hash].js',
|
|
entryFileNames: 'assets/js/[name]-[hash].js',
|
|
assetFileNames: 'assets/[ext]/[name]-[hash].[ext]'
|
|
}
|
|
},
|
|
// Enable source maps for better debugging
|
|
sourcemap: false,
|
|
// Increase chunk size warning limit
|
|
chunkSizeWarningLimit: 1000
|
|
},
|
|
// Optimize dependencies
|
|
optimizeDeps: {
|
|
include: ['vue', 'vue-router']
|
|
}
|
|
}
|
|
})
|