-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
38 lines (37 loc) · 1.07 KB
/
vite.config.ts
File metadata and controls
38 lines (37 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import path from 'path'
export default defineConfig({
plugins: [react()],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
},
},
build: {
outDir: 'dist',
},
// ES worker format so @jsquash's multi-threaded AVIF encoder and
// other code-split worker bundles can be built (default 'iife' rejects
// multi-chunk worker output).
worker: {
format: 'es',
},
// Exclude @jsquash packages from Vite's dep pre-bundling. Pre-bundling
// rewrites `new URL('./foo.wasm', import.meta.url)` into a path that
// doesn't exist on the dev server, causing the SPA fallback to return
// index.html instead of the WASM binary and failing with
// `expected magic word 00 61 73 6d, found 3c 21 44 4f` (`<!DO…`).
// Native ESM resolution preserves the sibling .wasm relative URL.
optimizeDeps: {
exclude: ['@jsquash/avif'],
},
server: {
proxy: {
'/shard': {
target: 'http://localhost:8686',
changeOrigin: true,
},
},
},
})