forked from TBXark/ChatGPT-Telegram-Workers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
51 lines (47 loc) · 1.22 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
44
45
46
47
48
49
50
51
import type { LibraryFormats, Plugin } from 'vite';
import * as path from 'node:path';
import { nodeResolve } from '@rollup/plugin-node-resolve';
import cleanup from 'rollup-plugin-cleanup';
import { nodeExternals } from 'rollup-plugin-node-externals';
import { defineConfig } from 'vite';
import checker from 'vite-plugin-checker';
import dts from 'vite-plugin-dts';
import { createVersionPlugin } from './src/vite/version';
const {
TYPES = 'false',
FORMATS = 'es',
ENTRY = 'src/entry/core/index.ts',
} = process.env;
const plugins: Plugin[] = [
nodeResolve({
browser: false,
preferBuiltins: true,
}),
cleanup({
comments: 'none',
extensions: ['js', 'ts'],
}),
checker({
typescript: true,
}),
nodeExternals(),
createVersionPlugin(path.resolve(__dirname)),
];
if (TYPES === 'true') {
plugins.push(
dts(),
);
}
export default defineConfig({
plugins,
build: {
target: 'esnext',
lib: {
entry: path.resolve(__dirname, ENTRY),
fileName: 'index',
formats: FORMATS.split(',') as LibraryFormats[],
},
minify: false,
outDir: path.resolve(__dirname, 'dist'),
},
});