-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
31 lines (29 loc) · 747 Bytes
/
Copy pathvite.config.ts
File metadata and controls
31 lines (29 loc) · 747 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
import preact from '@preact/preset-vite'
import { ConfigEnv, UserConfig, defineConfig } from "vite";
import fs from 'fs';
export default defineConfig((mode: ConfigEnv): UserConfig => {
return {
plugins: [preact()],
build: {
target: "esnext",
minify: false,
outDir: "dist",
watch: 'src',
lib: {
entry: 'src/index.tsx',
name: 'index',
fileName: () => 'index.user.js',
formats: ["iife"]
},
rollupOptions: {
output: {
banner: () => fs.readFileSync('src/userscript-header.js', 'utf-8')
},
}
},
define: {
// https://github.com/vitejs/vite/discussions/13587
"process.env.NODE_ENV": JSON.stringify(mode),
},
}
});