-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.mts
More file actions
87 lines (86 loc) · 2.27 KB
/
vite.config.mts
File metadata and controls
87 lines (86 loc) · 2.27 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/// <reference types='vitest' />
import { join } from 'node:path';
import { builtinModules } from 'node:module';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import dts from 'vite-plugin-dts';
import swc from '@rollup/plugin-swc';
export default defineConfig(() => ({
root: __dirname,
cacheDir: '../../node_modules/.vite/packages/fetch',
plugins: [
tsconfigPaths(),
swc({
swc: {
jsc: {
parser: {
syntax: 'typescript',
dynamicImport: true,
decorators: true,
},
target: 'es2021',
transform: {
decoratorMetadata: true,
},
minify: {
mangle: true,
keep_classnames: true,
sourceMap: true,
},
},
},
}),
dts({
entryRoot: 'src',
tsconfigPath: join(__dirname, 'tsconfig.lib.json'),
rollupTypes: true,
insertTypesEntry: true,
}),
],
esbuild: false as const,
// Uncomment this if you are using workers.
// worker: {
// plugins: [ nxViteTsPaths() ],
// },
// Configuration for building your library.
// See: https://vitejs.dev/guide/build.html#library-mode
build: {
outDir: './dist',
emptyOutDir: true,
reportCompressedSize: true,
commonjsOptions: {
transformMixedEsModules: true,
},
lib: {
// Could also be a dictionary or array of multiple entry points.
entry: 'src/index.ts',
name: 'assemblerjs-fetch',
fileName: 'index',
// Change this to the formats you want to support.
// Don't forget to update your package.json as well.
formats: ['es' as const, 'cjs' as const],
},
rollupOptions: {
// External packages that should not be bundled into your library.
external: [
'assemblerjs',
'@assemblerjs/core',
'which',
'mongoose',
...builtinModules.flatMap((p) => [p, `node:${p}`]),
],
},
minify: 'terser' as const,
},
test: {
watch: true,
globals: true,
environment: 'node',
include: ['{src,e2e}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
reporters: ['default'],
coverage: {
reportsDirectory: './coverage',
provider: 'istanbul' as const,
},
},
}));