-
Notifications
You must be signed in to change notification settings - Fork 9
/
vite.config.ts
85 lines (84 loc) · 2.09 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
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import { resolve } from 'path';
import { defineConfig } from 'vitest/config';
import wasm from 'vite-plugin-wasm';
import topLevelAwait from 'vite-plugin-top-level-await';
import commonjs from 'vite-plugin-commonjs';
import { viteStaticCopy } from 'vite-plugin-static-copy';
import nodeResolve from '@rollup/plugin-node-resolve';
import tsconfigPaths from 'vite-tsconfig-paths';
import dts from 'vite-plugin-dts';
import checker from 'vite-plugin-checker';
import eslint from 'vite-plugin-eslint';
import vitest from 'eslint-plugin-vitest';
export default defineConfig({
plugins: [
checker({
typescript: { tsconfigPath: './tsconfig.build.json' },
}),
eslint({
include: ['./lib/**/*.ts'],
}),
wasm(),
topLevelAwait(),
viteStaticCopy({
targets: [
{
src: './lib/hnswlib.wasm',
dest: './',
},
{
src: './lib/hnswlib.wasm.map',
dest: './',
},
{
src: './lib/hnswlib-wasm.d.ts',
dest: './',
},
],
}),
tsconfigPaths(),
dts({
insertTypesEntry: true,
tsconfigPath: './tsconfig.build.json',
}),
],
optimizeDeps: {},
build: {
minify: false,
sourcemap: true,
lib: {
// Could also be a dictionary or array of multiple entry points
entry: resolve(__dirname, 'lib/index.ts'),
name: 'hnswlib-wasm',
// the proper extensions will be added
fileName: 'hnswlib',
formats: ['es'],
},
commonjsOptions: {
include: [],
exclude: [],
},
rollupOptions: {
// make sure to externalize deps that shouldn't be bundled
// into your library
external: [],
},
},
test: {
globals: true,
include: ['test/**/*.test.ts'],
//exclude: ['bench/**/*.ts'],
setupFiles: ['./vitest.setup.ts'],
environment: 'happy-dom',
benchmark: {
include: ['**/*.bench.test.ts'],
},
// exclude: ['test/**/*.bench.ts'],
// browser: {
// enabled: true,
// name: 'chromium',
// headless: true,
// provider: 'playwright'
// }
},
});