forked from hieplpvip/guesslang-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.ts
More file actions
37 lines (34 loc) · 778 Bytes
/
vite.config.ts
File metadata and controls
37 lines (34 loc) · 778 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
34
35
36
37
import { LibraryFormats } from 'vite';
import { defineConfig } from 'vite'
// build esm
export default defineConfig(() => {
const BUILD_TARGET = process.env.BUILD_TARGET || 'esm&umd'
if (BUILD_TARGET === 'worker') {
return {
build: {
outDir: 'dist/worker',
target: 'es6',
assetsDir: '',
lib: {
name: 'guesslang-worker',
entry: './lib/worker-wrapper.ts',
formats: ['es'] satisfies LibraryFormats[]
}
},
worker: {
format: 'es' as const,
},
}
}
return {
build: {
outDir: 'dist/lib',
target: 'es6',
lib: {
name: 'guesslang',
entry: './lib/index.ts',
formats: ['es'] satisfies LibraryFormats[]
}
},
}
})