-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.js
More file actions
54 lines (51 loc) · 1.19 KB
/
vite.config.js
File metadata and controls
54 lines (51 loc) · 1.19 KB
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
52
53
54
import { defineConfig } from 'vite'
import { configDefaults } from 'vitest/config'
import react from '@vitejs/plugin-react'
export default defineConfig({
plugins: [react()],
build: {
target: 'esnext',
lib: {
formats: ['es'],
entry: {
index: './src/index.ts'
}
},
rolldownOptions: {
external: id => /^(next|react|@nano_kit)\/?/.test(id),
output: {
topLevelVar: false,
codeSplitting: {
groups: [
{
name(id, ctx) {
const { code } = ctx.getModuleInfo(id)
if (/^\s*['"]use client['"]/.test(code)) {
return 'client'
}
return null
}
}
]
},
banner(chunk) {
if (chunk.name === 'client') {
return `'use client';`
}
}
}
},
sourcemap: true,
minify: false,
emptyOutDir: false
},
test: {
environment: 'happy-dom',
setupFiles: ['@testing-library/jest-dom/vitest'],
exclude: [...configDefaults.exclude, './package'],
coverage: {
reporter: ['lcovonly', 'text'],
include: ['src/**/*']
}
}
})