Production JS bundle was a few very long minified lines (first line ~105K, max ~190K). Some JS engines/browsers (notably older Safari/iOS) fail to parse a single minified line that long, throwing 'SyntaxError: 10' at the end of line 1 and showing a white screen even though the asset is served complete and valid (verified: hash matches local, node --check passes, full 564K). Switch to terser minifier with max_line_len=120 so the bundle emits 4,988 short lines (max ~1.9K) instead of ~24 huge lines. Asset hash changes (cache-bust). Frontend 10 tests pass; build OK. Also fix docker-compose port: SPA is now served by nginx on :8080, so map external 3000 -> 8080 (was 3000->3000 pointing at a removed vite dev server).
39 lines
1021 B
JavaScript
39 lines
1021 B
JavaScript
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import path from 'path'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [vue()],
|
|
build: {
|
|
// Split minified output into shorter lines instead of one very long line.
|
|
// Some JS engines/browsers (notably old Safari/iOS) fail to parse a single
|
|
// minified line that is tens of KB long ("SyntaxError" at the end of the
|
|
// first line). Terser emits many short lines, keeping size ~equivalent.
|
|
minify: 'terser',
|
|
terserOptions: {
|
|
compress: { passes: 1 },
|
|
format: { max_line_len: 120 },
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, 'src'),
|
|
'@locales': path.resolve(__dirname, '../locales')
|
|
}
|
|
},
|
|
server: {
|
|
port: 3000,
|
|
host: '0.0.0.0',
|
|
open: false,
|
|
allowedHosts: true,
|
|
proxy: {
|
|
'/api': {
|
|
target: process.env.API_BACKEND_URL || 'http://localhost:5001',
|
|
changeOrigin: true,
|
|
secure: true
|
|
}
|
|
}
|
|
}
|
|
})
|