-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
45 lines (42 loc) · 1.04 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
import * as path from 'path';
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';
declare const process: {
readonly env: {
[name: string]: string;
};
};
const { PORT } = process.env;
// https://vitejs.dev/config/
export default ({ mode }) => {
return defineConfig({
plugins: [react()],
server: {
host: '127.0.0.1',
port: (PORT && parseInt(PORT)) || 3000,
},
esbuild: {
// Avoid conflicting with "import React"
jsxFactory: '_implicit_React.createElement',
jsxFragment: '_implicit_React.Fragment',
jsxInject: 'import _implicit_React from "react"',
},
build: {
target: 'esnext',
outDir: '../cosmos-export',
rollupOptions: {
input: {
renderer: path.resolve(__dirname, 'cosmos/renderer.html'), // for cosmos experimentalRendererUrl
},
},
},
base: '',
root: './cosmos',
optimizeDeps: {
exclude: ['vis-timeline', 'vis-data'],
},
define: {
__DEV__: mode === 'development',
},
});
};