-
-
Notifications
You must be signed in to change notification settings - Fork 151
/
Copy pathvite.config.mts
40 lines (34 loc) · 1.04 KB
/
vite.config.mts
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
import preact from '@preact/preset-vite';
import {defineConfig} from 'vite';
import banner from 'vite-plugin-banner';
import dts from 'vite-plugin-dts';
import {version} from './package.json';
const header = `/*! @viselect/preact v${version} MIT | https://github.com/Simonwep/selection/tree/master/packages/preact */`;
export default defineConfig(env => ({
root: env.mode === 'production' ? '.' : './demo',
plugins: [preact(), banner(header), dts()],
build: {
sourcemap: true,
minify: 'esbuild',
lib: {
entry: 'src/index.tsx',
name: 'SelectionArea',
fileName: 'viselect',
},
rollupOptions: {
external: ['preact', 'preact/hooks', '@viselect/vanilla'],
output: {
globals: {
preact: 'Preact',
'@viselect/vanilla': 'SelectionArea'
},
},
},
},
server: {
port: 3006
},
define: {
'VERSION': JSON.stringify(version)
}
}));