-
-
Notifications
You must be signed in to change notification settings - Fork 373
Expand file tree
/
Copy pathvite.config.mjs
More file actions
44 lines (42 loc) · 1.07 KB
/
vite.config.mjs
File metadata and controls
44 lines (42 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
39
40
41
42
43
44
import {join} from 'node:path';
import react from '@vitejs/plugin-react';
import {defineConfig} from 'vite';
// https://vitejs.dev/config/
export default defineConfig(({command}) => {
const commonConfig = {
build: {
outDir: join(__dirname, 'dist-browser'),
emptyOutDir: true,
minify: false,
reportCompressedSize: false,
target: 'es2022',
},
define: {
// add empty polyfills for some Node.js primitives
'process.argv': [],
'process.env': {},
},
plugins: [
react({
babel: {
plugins: ['babel-plugin-react-compiler'],
},
}),
],
resolve: {
alias: {
'#local-polyfills': join(__dirname, 'app', 'web', 'polyfills'),
},
},
root: join(__dirname, 'app', 'common'),
test: {
mockReset: true,
root: join(__dirname, 'test'),
},
};
// workaround to prevent webdriver from bundling various Node.js imports
if (command === 'build') {
commonConfig.define = {...commonConfig.define, 'globalThis.window': true};
}
return commonConfig;
});