-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
54 lines (51 loc) · 1.44 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
/// <reference types="vitest" />
import mdx from '@mdx-js/rollup';
import react from '@vitejs/plugin-react';
import { visualizer } from 'rollup-plugin-visualizer';
import { defineConfig, PluginOption } from 'vite';
import { qrcode } from 'vite-plugin-qrcode';
import pluginRewriteAll from 'vite-plugin-rewrite-all';
import svgrPlugin from 'vite-plugin-svgr';
import viteTsconfigPaths from 'vite-tsconfig-paths';
/**
* To set up a development proxy, create and edit the file dev-proxy/proxy-table.ts
* You can copy and rename one of the included examples.
* See https://vitejs.dev/config/server-options.html#server-proxy for syntax
*/
const proxyTable = await import('./dev-proxy/proxy-table').catch((err) => {
console.error(err);
console.log('Fallback to empty proxy table');
return { devProxy: {} };
});
const devProxy = proxyTable.devProxy;
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
{
enforce: 'pre',
...mdx({}),
},
react(),
viteTsconfigPaths(),
svgrPlugin(),
pluginRewriteAll(),
qrcode({
filter: (url) => url.startsWith('http://192'),
}),
visualizer({
template: 'treemap', // or sunburst
open: true,
gzipSize: true,
brotliSize: true,
filename: 'bundle-analyse.html',
}) as PluginOption,
],
build: {
outDir: 'build',
},
server: {
proxy: devProxy,
host: '0.0.0.0', // listen on all network interfaces
},
test: {},
});