-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
73 lines (66 loc) · 2.06 KB
/
vite.config.js
File metadata and controls
73 lines (66 loc) · 2.06 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import tailwindcss from '@tailwindcss/vite';
import { resolve } from 'path';
export default defineConfig({
plugins: [tailwindcss()],
// Test config
test: {
environment: 'jsdom',
include: ['src/**/*.test.js'],
},
// Serve from root
root: '.',
// Alias /pkg/ to the npm package so we use the installed version
resolve: {
alias: {
'/pkg': resolve(__dirname, 'node_modules/@rustledger/wasm'),
},
},
// Dev server config
server: {
port: 8080,
open: false,
// Watch for changes in all files
watch: {
usePolling: false,
},
},
// Build config for GitHub Pages
build: {
outDir: 'dist',
// Multi-page build configuration
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
playground: resolve(__dirname, 'playground.html'),
},
output: {
entryFileNames: 'assets/[name].js',
chunkFileNames: 'assets/[name]-[hash].js',
assetFileNames: 'assets/[name].[ext]',
// Split heavy libraries into separate chunks for better caching
manualChunks: {
// CodeMirror core (loaded immediately for editor)
codemirror: [
'codemirror',
'@codemirror/autocomplete',
'@codemirror/commands',
'@codemirror/language',
'@codemirror/state',
'@codemirror/view',
'@lezer/highlight',
],
// D3 visualization (lazy loaded)
d3: ['d3', 'd3-sankey'],
},
},
},
},
// Worker config - use ES modules for dynamic imports
worker: {
format: 'es',
},
// Handle WASM files correctly
assetsInclude: ['**/*.wasm'],
});