-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.ts
98 lines (97 loc) · 2.64 KB
/
vite.config.ts
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import million from 'million/compiler';
import { defineConfig, searchForWorkspaceRoot } from 'vite';
import react from '@vitejs/plugin-react';
import { TanStackRouterVite } from '@tanstack/router-vite-plugin';
import { VitePWA } from 'vite-plugin-pwa';
import path from 'path';
import { replaceCodePlugin } from 'vite-plugin-replace';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
replaceCodePlugin({
replacements: [
{
from: 'Worker.js', // 'js' extension is required when @logic-pad/core is compiled by tsc
to: 'Worker.ts', // but vite uses 'ts' extension for worker imports
},
],
}),
million.vite({ auto: true }),
react(),
TanStackRouterVite({
routesDirectory: './src/client/routes',
generatedRouteTree: './src/client/router/routeTree.gen.ts',
}),
VitePWA({
registerType: 'prompt',
includeAssets: [
'favicon.ico',
'apple-touch-icon-180x180.png',
'z3-built.js',
'z3-built.wasm',
'z3-built.worker.js',
],
manifest: {
name: 'Logic Pad',
short_name: 'Logic Pad',
description: 'A modern, open-source web app for grid-based puzzles.',
theme_color: '#414558',
background_color: '#edeff7',
icons: [
{
src: 'pwa-64x64.png',
sizes: '64x64',
type: 'image/png',
},
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
},
{
src: 'maskable-icon-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
},
}),
],
server: {
headers: {
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp',
},
fs: {
allow: [searchForWorkspaceRoot(process.cwd()), './', '../logic-core'], // allow serving files from the logic-core package for local testing
},
},
optimizeDeps: {
exclude: ['@logic-pad/core'],
include: ['event-iterator', 'z3-solver'],
},
resolve: {
alias: [
{
find: '@logic-pad/core/assets',
replacement: path.join(
searchForWorkspaceRoot(process.cwd()),
'./packages/logic-core/assets'
),
},
{
find: '@logic-pad/core',
replacement: path.join(
searchForWorkspaceRoot(process.cwd()),
'./packages/logic-core/src'
),
},
],
},
});