forked from TypeFox/monaco-languageclient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
94 lines (87 loc) · 3.19 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
/* --------------------------------------------------------------------------------------------
* Copyright (c) 2024 TypeFox and others.
* Licensed under the MIT License. See LICENSE in the package root for license information.
* ------------------------------------------------------------------------------------------ */
import { defineConfig as defineViteConfig, mergeConfig } from 'vite';
import { defineConfig as defineVitestConfig } from 'vitest/config';
import * as path from 'path';
// import * as fs from 'fs';
import importMetaUrlPlugin from '@codingame/esbuild-import-meta-url-plugin';
import vsixPlugin from '@codingame/monaco-vscode-rollup-vsix-plugin';
import react from '@vitejs/plugin-react';
const viteConfig = defineViteConfig({
build: {
target: 'esnext',
rollupOptions: {
input: {
index: path.resolve(__dirname, 'index.html'),
// bare monaco-languageclient
bare: path.resolve(__dirname, 'packages/examples/bare.html'),
// monaco-editor-wrapper
// json
wrapperWebSocket: path.resolve(__dirname, 'packages/examples/wrapper_ws.html'),
browser: path.resolve(__dirname, 'packages/examples/browser.html'),
// langium
wrapperStatemachine: path.resolve(__dirname, 'packages/examples/wrapper_statemachine.html'),
wrapperLangium: path.resolve(__dirname, 'packages/examples/wrapper_langium.html'),
// python
python: path.resolve(__dirname, 'packages/examples/python.html'),
// grrovy
groovy: path.resolve(__dirname, 'packages/examples/groovy.html'),
// monaco-editor-react
// langium
reactStatemachine: path.resolve(__dirname, 'packages/examples/react_statemachine.html'),
// python
reactPython: path.resolve(__dirname, 'packages/examples/react_python.html'),
// other examples
wrapperTs: path.resolve(__dirname, 'packages/examples/wrapper_ts.html'),
wrapperAdvanced: path.resolve(__dirname, 'packages/examples/wrapper_adv.html'),
}
}
},
resolve: {
// not needed here, see https://github.com/TypeFox/monaco-languageclient#vite-dev-server-troubleshooting
// dedupe: ['vscode']
},
server: {
origin: 'http://localhost:20001',
port: 20001
},
optimizeDeps: {
esbuildOptions: {
plugins: [
importMetaUrlPlugin
]
}
},
plugins: [
vsixPlugin(),
react(),
],
define: {
rootDirectory: JSON.stringify(__dirname)
},
worker: {
format: 'es'
}
});
const vitestConfig = defineVitestConfig({
test: {
testTimeout: 10000,
pool: 'threads',
poolOptions: {
threads: {
isolate: true
}
},
browser: {
enabled: true,
headless: true,
name: 'chrome',
api: {
port: 20101
}
}
}
});
export default mergeConfig(viteConfig, vitestConfig);