-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.mts
50 lines (49 loc) · 1.25 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
41
42
43
44
45
46
47
48
49
50
import { defineConfig } from 'vitest/config';
import pkg from './package.json';
import { builtinModules } from 'module';
/**
* vite config
* @ref https://vitejs.dev/
* vitest config
* @ref https://vitest.dev/
*/
export default defineConfig({
define: {
'process.env.PKG_NAME': JSON.stringify(pkg.name),
'process.env.PKG_VERSION': JSON.stringify(pkg.version),
},
build: {
minify: false,
sourcemap: false,
copyPublicDir: false,
reportCompressedSize: false,
target: 'ES2023',
lib: {
entry: {
index: 'src/index.ts',
},
},
rollupOptions: {
external: [...builtinModules, ...builtinModules.map((m) => `node:${m}`)],
output: [
{
format: 'cjs',
entryFileNames: '[name].cjs',
chunkFileNames: '[name].cjs',
},
],
},
},
test: {
globals: true,
env: {
PKG_NAME: 'pkg-name-for-test',
PKG_VERSION: 'pkg-version-for-test',
},
coverage: {
all: true,
include: ['src/**/*.ts'],
reporter: ['lcov', 'text'],
},
},
});