-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.ts
49 lines (45 loc) · 1.14 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
import path from 'path';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import packgeJson from './package.json';
const ignoreDeps = ['axios'];
const externalPackages = Object.keys(packgeJson.dependencies).filter(
(k) => !ignoreDeps.includes(k)
);
export default defineConfig(async () => ({
esbuild: {
minifySyntax: true,
},
build: {
outDir: path.resolve(__dirname, 'dist'),
minify: true,
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
name: 'UsableQuery',
formats: ['es', 'umd'],
fileName: (format) => `index.${format}.js`,
},
rollupOptions: {
external: [...externalPackages, '@tanstack/react-query'],
output: {
globals: {
...externalPackages.reduce((acc, curr) => {
acc[curr] = curr;
return acc;
}, {}),
'@tanstack/react-query': 'ReactQuery',
},
},
},
},
plugins: [
dts({
include: ['src'],
tsConfigFilePath: path.resolve(__dirname, './tsconfig.json'),
compilerOptions: {
declaration: true,
emitDeclarationOnly: true,
},
}),
],
}));