-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathvite.config.ts
43 lines (42 loc) · 1.4 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
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import path from 'path';
import tsconfigPaths from 'vite-tsconfig-paths';
const root = path.resolve(__dirname, 'app');
const port = Number(process.argv.find((arg) => arg.startsWith('--port='))?.split('=')[1]) || 8080;
// https://vitejs.dev/config/
export default defineConfig({
root: root,
server: {
origin: `http://127.0.0.1:${port}`,
port,
},
build: {
assetsInlineLimit: 131072, // 128kb
rollupOptions: {
input: root,
output: {
sourcemap: true,
entryFileNames: 'app.js',
format: 'iife',
// chunks don't work with iife
// chunkFileNames: 'vendors.js',
// manualChunks: {
// // Bundle all code from `node_modules` into a separate file called `vendors`
// vendors: ['react', 'react-dom', 'antd'],
// },
},
},
outDir: path.resolve(__dirname, 'dist'),
},
plugins: [tsconfigPaths(), react()],
test: {
globals: true,
environment: 'jsdom',
setupFiles: path.join(root, 'test', 'setup.ts'),
// you might want to disable it, if you don't have tests that rely on CSS
// since parsing CSS is slow
css: true,
},
});