-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
33 lines (31 loc) · 873 Bytes
/
vite.config.ts
File metadata and controls
33 lines (31 loc) · 873 Bytes
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
import preact from '@preact/preset-vite';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import replace from '@rollup/plugin-replace';
import { execSync } from 'child_process';
import { defineConfig } from 'vite';
let revision = Date.now().toString(36);
try {
revision = execSync('git rev-parse HEAD', { cwd: __dirname }).toString().trim();
} catch (e) {}
// https://vitejs.dev/config/
export default defineConfig({
build: {
target: 'es2019',
rollupOptions: {
plugins: [replace({ __GIT_REV__: revision }), resolve(), commonjs()]
}
},
resolve: {
alias: {
react: 'preact/compat',
'react-dom/test-utils': 'preact/test-utils',
'react-dom': 'preact/compat',
'react/jsx-runtime': 'preact/jsx-runtime'
}
},
server: {
port: 5000,
},
plugins: [preact()]
});