-
Notifications
You must be signed in to change notification settings - Fork 16
/
vite.config.ts
66 lines (65 loc) · 1.55 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
import react from '@vitejs/plugin-react';
import alias from '@rollup/plugin-alias';
import { join } from 'node:path';
import { Routes } from './src/utilities/enums';
import { VitePWA } from 'vite-plugin-pwa';
import autoprefixer from 'autoprefixer';
import cssNanoPlugin from 'cssnano';
import vitePrerender from 'vite-plugin-prerender';
import { defineConfig } from 'vite';
import postcssFlexbugsFixes from 'postcss-flexbugs-fixes';
export default defineConfig({
plugins: [
react(),
VitePWA({
registerType: 'autoUpdate',
includeAssets: ['favicon.ico'],
manifest: {
name: 'React Template',
short_name: 'React TPL',
description: 'A React application!',
theme_color: '#333333',
icons: [
{
src: 'icon-512x512.png',
sizes: '512x512',
type: 'image/png'
}
]
}
}),
vitePrerender({
staticDir: join(__dirname, 'dist'),
routes: Object.values(Routes)
}),
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
alias({
entries: {
'@src': '/src',
'@i18n': '/src/i18n',
'@store': '/src/store',
'@mocks': '/src/__mocks__',
'@assets': '/src/assets',
'@components': '/src/components',
'@containers': '/src/containers',
'@utilities': '/src/utilities'
}
})
],
css: {
preprocessorOptions: {
scss: {
additionalData: `
@use 'sass:list';
@use 'sass:color';
@use 'sass:string';
@import "./src/assets/styles/settings.scss";
`
}
},
postcss: {
plugins: [autoprefixer, postcssFlexbugsFixes as any, cssNanoPlugin]
}
}
});