main
ts 45 lines 1.42 KB
Raw
1 import { defineConfig } from 'vite'
2 import legacy from '@vitejs/plugin-legacy'
3 import preact from '@preact/preset-vite'
4
5 // https://vitejs.dev/config/
6 export default defineConfig(async () => {
7 const Sonda = process.env.BUNDLE_REPORT ? (await import('sonda/vite')).default : null
8 return {
9 build: {
10 outDir: '../dist/frontend',
11 emptyOutDir: true,
12 sourcemap: Boolean(Sonda),
13 //target: "chrome69",
14 },
15 resolve: {
16 alias: {
17 'react': 'preact/compat',
18 'react-dom': 'preact/compat',
19 'react-dom/test-utils': 'preact/test-utils',
20 'react/jsx-runtime': 'preact/jsx-runtime',
21 },
22 },
23 server: {
24 port: 3005,
25 host: '127.0.0.1',
26 proxy: {
27 '/~/': {
28 target: 'http://localhost',
29 proxyTimeout: 2000,
30 changeOrigin: true,
31 ws: true,
32 }
33 }
34 },
35 plugins: [
36 preact(),
37 legacy({
38 renderModernChunks: false, // single version, legacy one
39 polyfills: false, // keeping polyfills at a minimum, manually
40 targets: ['firefox 40', 'chrome 69'],
41 }),
42 ... Sonda ? [Sonda({ detailed: true, gzip: true, brotli: true })] : [],
43 ],
44 }
45 })