-
Notifications
You must be signed in to change notification settings - Fork 4
/
vite.config.ts
74 lines (73 loc) · 1.73 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
import eslintPlugin from '@nabla/vite-plugin-eslint';
import react from '@vitejs/plugin-react';
import { resolve } from 'node:path';
import { defineConfig } from 'vite';
import dts from 'vite-plugin-dts';
import VitePluginReactRemoveAttributes from 'vite-plugin-react-remove-attributes';
import svgLoader from 'vite-svg-loader';
import tsConfigPaths from 'vite-tsconfig-paths';
import { name } from './package.json';
export default defineConfig(() => ({
resolve: {
alias: {
'~': resolve(__dirname)
}
},
plugins: [
eslintPlugin(),
svgLoader({
defaultImport: 'raw' // Allows DS to render it's own icons
}),
react(),
tsConfigPaths(),
dts({
insertTypesEntry: true
}),
VitePluginReactRemoveAttributes({
attributes: ['data-testid']
})
],
test: {
globals: true,
environment: 'jsdom',
clearMocks: true,
coverage: {
provider: 'istanbul',
enabled: true,
'100': true,
reporter: ['text', 'lcov'],
reportsDirectory: 'coverage',
all: false
},
server: {
deps: {
// [Fix] TypeError: Unknown file extension ".svg" for @cpfb/cfpb-icons
inline: ['@cfpb']
}
}
},
build: {
lib: {
entry: resolve('src', 'index.ts'),
name,
formats: ['es', 'cjs'],
fileName: (format): string => `${name}.${format}.js`
},
rollupOptions: {
external: ['react', 'react-dom', 'react-router-dom'],
output: {
globals: {
react: 'React',
'react-dom': 'ReactDOM',
'react-router-dom': 'ReactRouterDOM'
}
}
},
optimizeDeps: {
exclude: ['react', 'react-dom', 'react-router-dom']
},
esbuild: {
minify: true
}
}
}));