-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvite.config.base.ts
More file actions
47 lines (42 loc) · 1.07 KB
/
vite.config.base.ts
File metadata and controls
47 lines (42 loc) · 1.07 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
import { Plugin, PluginOption } from 'vite';
import react from '@vitejs/plugin-react';
import viteTsConfigPaths from 'vite-tsconfig-paths';
import svgr from 'vite-plugin-svgr';
import path from 'path';
/**
* Our svgs are parsed into React components, but were still being emitted to the dist folder without this.
*/
export const preventSVGEmit: () => PluginOption = () => ({
name: 'Prevent SVG emit',
generateBundle(_opts, bundle) {
for (const key in bundle) {
if (key.endsWith('.svg')) {
delete bundle[key];
}
}
},
});
// Base configuration shared by all packages
export const baseViteConfig = {
build: {
sourcemap: true,
},
css: {
preprocessorOptions: {
scss: {
api: 'modern-compiler',
},
},
},
resolve: {
alias: {
'common-ui': path.resolve(__dirname, './packages/common-ui/src'),
},
},
plugins: [
react(),
svgr(),
preventSVGEmit(),
viteTsConfigPaths(),
],
};