All checks were successful
CI / update (push) Successful in 1m5s
- 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
40 lines
810 B
TypeScript
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';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|