-
Notifications
You must be signed in to change notification settings - Fork 2
/
vite.config.js
52 lines (50 loc) · 1.64 KB
/
vite.config.js
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
import path from 'path';
import svgr from '@svgr/rollup';
import react from '@vitejs/plugin-react';
import { defineConfig, splitVendorChunkPlugin } from 'vite';
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
svgr({ icon: true }),
react({
babel: {
plugins: [
[
'babel-plugin-styled-components',
{
displayName: true,
fileName: false,
ssr: false,
},
],
],
},
}),
splitVendorChunkPlugin(),
],
resolve: {
alias: [
{ find: '@components', replacement: path.resolve(__dirname, 'src/components') },
{ find: '@pages', replacement: path.resolve(__dirname, 'src/pages') },
{ find: '@utils', replacement: path.resolve(__dirname, 'src/utils') },
{ find: '@hooks', replacement: path.resolve(__dirname, 'src/hooks') },
{ find: '@api', replacement: path.resolve(__dirname, 'src/api') },
{ find: '@layout', replacement: path.resolve(__dirname, 'src/shared/layout') },
{ find: '@routes', replacement: path.resolve(__dirname, 'src/shared/routes') },
{ find: '@device', replacement: path.resolve(__dirname, 'src/style/breakpoints') },
{ find: '@style', replacement: path.resolve(__dirname, 'src/style') },
{ find: '@assets', replacement: path.resolve(__dirname, 'src/assets') },
],
},
build: {
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('react-router-dom') || id.includes('@remix-run') || id.includes('react-router')) {
return '@react-router';
}
},
},
},
},
});