-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathvite.config.ts
More file actions
60 lines (58 loc) · 1.64 KB
/
vite.config.ts
File metadata and controls
60 lines (58 loc) · 1.64 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
import { defineConfig } from 'vite'
import { nodePolyfills } from 'vite-plugin-node-polyfills'
import path from 'path'
/**
* Vite config to generate the ESM & CJS bundles for Synapse React Client.
*/
const config = defineConfig({
// Assets will be served from the `/Portal/cdn` servlet, which will redirect requests to the CDN when appropriate
base: '/Portal/cdn/generated/vite/',
server: {
host: '0.0.0.0', // Bind to all interfaces so Docker can access it
cors: {
origin: ['http://localhost:8888', 'http://127.0.0.1:8888'],
},
},
build: {
manifest: true,
outDir: './src/main/webapp/generated/vite',
rollupOptions: {
input: 'js/main.js',
onwarn(warning, warn) {
// Suppress "Module level directives cause errors when bundled" warnings
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') {
return
}
warn(warning)
},
},
},
optimizeDeps: {
include: [
// We must import @emotion libraries so MUI uses them
'@emotion/react',
'@emotion/styled',
],
},
resolve: {
alias: {
// jsdom is only used by synapse-react-client's SanitizeHtmlUtils in
// non-browser environments (guarded by typeof window === "undefined").
// This stub satisfies static resolution without including jsdom in the bundle.
jsdom: path.resolve(__dirname, 'js/stubs/jsdom.js'),
},
dedupe: [
'@emotion/react',
'@emotion/styled',
'jotai',
'react',
'react-dom',
],
},
plugins: [nodePolyfills()],
define: {
__TEST__: JSON.stringify(false),
__DEV__: JSON.stringify(false),
},
})
export default config