forked from FabricMC/mcsrc
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
65 lines (64 loc) · 1.88 KB
/
Copy pathvite.config.ts
File metadata and controls
65 lines (64 loc) · 1.88 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
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';
// https://vite.dev/config/
export default defineConfig({
base: process.env.NODE_ENV === 'production' ? '/mcsrc/' : '/',
plugins: [
react(),
svgr(),
{
name: 'suppress-wasm-warnings',
configResolved(config) {
// oxlint-disable-next-line typescript/unbound-method
const originalWarn = config.logger.warn;
config.logger.warn = (msg, options) => {
// Suppress WASM runtime externalization warnings
if (msg.includes('externalized for browser compatibility') && msg.includes('wasm-runtime.js')) {
return;
}
originalWarn(msg, options);
};
},
},
],
worker: {
format: 'es',
},
test: {
exclude: ['**/node_modules/**', '**/dist/**', 'tests/**'],
},
server: {
headers: {
// E2E tests will fail on WebKit if caching enabled.
// Only seem to be a problem in localhost.
// https://predr.ag/blog/debugging-safari-if-at-first-you-succeed/
'Cache-Control': 'no-store',
'Cross-Origin-Opener-Policy': 'same-origin',
'Cross-Origin-Embedder-Policy': 'require-corp',
},
},
build: {
sourcemap: true,
chunkSizeWarningLimit: 10000,
rollupOptions: {
onwarn(warning, warn) {
// Suppress "Module externalized for browser compatibility" warnings for WASM runtime files
if (warning.code === 'MODULE_EXTERNALIZED' && warning.message?.includes('wasm-runtime.js')) {
return;
}
warn(warning);
},
output: {
manualChunks(id) {
if (id.includes('@xyflow/react') || id.includes('dagre')) {
return 'inheritance';
}
if (id.includes('monaco-editor')) {
return 'monaco';
}
},
},
},
},
});