-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathvite.config.mjs
More file actions
40 lines (39 loc) · 1.03 KB
/
vite.config.mjs
File metadata and controls
40 lines (39 loc) · 1.03 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
import { defineConfig } from 'vite';
import packageJSON from './package.json';
import module from 'node:module';
import wasm from 'vite-plugin-wasm';
import topLevelAwait from 'vite-plugin-top-level-await';
export default defineConfig({
plugins: [wasm(), topLevelAwait()],
build: {
target: 'node20',
lib: {
entry: {
'index': './src/index.ts',
'main': './src/main.ts'
},
fileName: (format, entryName) => `${entryName}.${format}.js`,
name: packageJSON.name,
formats: ['es', 'cjs'],
},
minify: false,
rollupOptions: {
external: [
...module.builtinModules,
...module.builtinModules.map((e) => `node:${e}`),
...Object.keys(packageJSON.dependencies || {}),
...Object.keys(packageJSON.peerDependencies || {}),
],
},
},
test: {
include: ['./tests/**/*.test.ts'],
environment: 'node',
coverage: {
enabled: true,
all: true,
include: ['src/**/*.ts'],
exclude: ['**/*.test.ts', 'src/main.ts'],
},
},
});