Files
homepage/vite.config.ts
Alexander Bocken 3daa5b65c5
All checks were successful
CI / update (push) Successful in 1m5s
fix: barcode scanner WASM loading and Android camera permission
- Exclude barcode-detector from Vite optimizeDeps to prevent WASM mangling
- Self-host ZXing WASM via Vite ?url import with prepareZXingModule
- Use barcode-detector/ponyfill instead of deprecated /pure export
- Separate barcode-detector/zxing-wasm into own chunk
- Add CAMERA permission to Android manifest for Tauri app
2026-04-05 12:23:18 +02:00

40 lines
810 B
TypeScript

import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
server: {
allowedHosts: ["bocken.org"]
},
plugins: [sveltekit()],
optimizeDeps: {
exclude: ['barcode-detector']
},
build: {
minify: 'terser',
terserOptions: {
compress: {
drop_console: ['log', 'debug'],
drop_debugger: true
}
},
rollupOptions: {
output: {
manualChunks: (id) => {
// Separate large dependencies into their own chunks
if (id.includes('node_modules')) {
if (id.includes('chart.js')) {
return 'chart';
}
if (id.includes('@auth/sveltekit')) {
return 'auth';
}
if (id.includes('barcode-detector') || id.includes('zxing-wasm')) {
return 'barcode';
}
}
}
}
}
}
});