forked from sussy-code/providers
-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.ts
42 lines (40 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
import path from 'path';
import { defineConfig } from 'vitest/config';
import eslintPlugin from '@nabla/vite-plugin-eslint';
import dts from 'vite-plugin-dts';
import pkg from './package.json';
const shouldTestProviders = process.env.MW_TEST_PROVIDERS === 'true';
let tests: string[] = ['src/__test__/standard/**/*.test.ts'];
if (shouldTestProviders) tests = ['src/__test__/providers/**/*.test.ts'];
export default defineConfig((env) => ({
plugins: [
env.mode !== 'test' && eslintPlugin(),
dts({
rollupTypes: true,
}),
],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
build: {
minify: false,
rollupOptions: {
external: Object.keys(pkg.dependencies),
output: {
globals: Object.fromEntries(Object.keys(pkg.dependencies).map((v) => [v, v])),
},
},
outDir: 'lib',
lib: {
entry: path.resolve(__dirname, 'src/index.ts'),
name: 'index',
fileName: 'index',
formats: ['umd', 'es'],
},
},
test: {
include: tests,
},
}));