-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.ts
42 lines (39 loc) · 1.03 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
/// <reference types="vitest" />
import { defineConfig } from 'vite';
import path from 'path';
import typescript from '@rollup/plugin-typescript';
import pkg from './package.json' assert { type: 'json' };
import dts from 'vite-plugin-dts';
import { builtinModules } from 'node:module';
const resolvePath = (str: string) => path.resolve(__dirname, str);
// https://vitejs.dev/config/
export default defineConfig({
build: {
outDir: 'dist',
lib: {
entry: resolvePath('./src/index.ts'),
name: pkg.name,
fileName: () => `index.js`,
formats: ['es'],
},
rollupOptions: {
plugins: [typescript()],
external: [
'vite',
...builtinModules,
...builtinModules.map(m => `node:${m}`),
...Object.keys(pkg.dependencies || {}),
...Object.keys(pkg.peerDependencies || {}),
],
},
},
test: {
globals: true,
environment: 'node',
coverage: {
provider: 'v8',
include: ['src/'],
},
},
plugins: [dts({ insertTypesEntry: true })],
});