-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathvite.config.ts
More file actions
69 lines (63 loc) · 1.87 KB
/
Copy pathvite.config.ts
File metadata and controls
69 lines (63 loc) · 1.87 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import tailwindcss from '@tailwindcss/vite';
import react from '@vitejs/plugin-react';
import { playwright } from '@vitest/browser-playwright';
import dts from 'unplugin-dts/vite';
import { defineConfig } from 'vitest/config';
import pack from './package.json' with { type: 'json' };
export default defineConfig({
plugins: [
react(),
dts({ entryRoot: 'src', exclude: ['test', '*.config.ts', '**/*.stories.*'] }),
tailwindcss(),
],
build: {
lib: {
entry: {
index: './src/index.ts',
},
formats: ['es'], // Generate ES module only
},
rolldownOptions: {
// Make sure dependencies and peer dependencies are not bundled with the library
external: [...Object.keys(pack.dependencies), ...Object.keys(pack.peerDependencies), 'react/jsx-runtime'],
output: {
// This ensures generated CSS file is called index.css, not style.css
assetFileNames: 'index.[ext]',
},
},
},
test: {
globals: true,
clearMocks: true,
setupFiles: ['./.storybook/tailwind.css'],
// Run tests in an actual browser
browser: {
provider: playwright({
// In CI, this instructs playwright to use a pre-existing Chrome instance
launchOptions: process.env.CI ? { channel: 'chrome' } : undefined,
}),
enabled: true,
headless: true,
screenshotFailures: false,
instances: [{ browser: 'chromium' }],
},
coverage: {
provider: 'v8',
reportsDirectory: './coverage',
include: [
'src/**/*.ts',
'src/**/*.tsx',
'!src/index.ts',
'!src/**/*.stories.{ts,tsx}',
],
reporter: ['text', 'text-summary', 'clover', 'html'],
// Required code coverage. Lower than this will make the check fail
thresholds: {
statements: 95,
branches: 90,
functions: 90,
lines: 95,
},
},
},
});