-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
81 lines (79 loc) · 1.87 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import { resolve } from 'path'
import alias from '@rollup/plugin-alias'
import WindiCSS from 'vite-plugin-windicss'
import { createHtmlPlugin } from 'vite-plugin-html'
/**
* @param match
* Regular expression in string or Regexp type,
* or a match predicate (this: vite transform context, code: string, id: file name string) => void
* @returns transformed code
*/
import plainText from 'vite-plugin-plain-text'
const projectRootDir = resolve(__dirname)
const range = (size, startAt = 1) => Array.from(Array(size).keys()).map(i => i + startAt)
export default {
root: 'src',
build: {
outDir: '../dist'
},
esbuild: {
jsxFactory: 'm',
jsxFragment: 'm.Fragment'
},
plugins: [
createHtmlPlugin({
minify: true
}),
WindiCSS({
root: '.',
scan: {
include: ['src/**/*.{html,js}']
}
}),
alias({
entries: [
{
find: 'mithril',
replacement: resolve(__dirname, 'node_modules/mithril/index.js')
},
{
find: 'Assets',
replacement: resolve(projectRootDir, './src/assets')
},
{
find: 'Utils',
replacement: resolve(projectRootDir, './src/utils')
},
{
find: 'Components',
replacement: resolve(projectRootDir, './src/components')
},
{
find: '@mui',
replacement: resolve(projectRootDir, './src/components/@mui')
},
{
find: 'Icons',
replacement: resolve(projectRootDir, './src/components/icons')
},
{
find: 'Services',
replacement: resolve(projectRootDir, './src/services')
}
]
})
],
css: {
preprocessorOptions: {
scss: {
additionalData: '@import "./src/scss/variables.scss";'
}
}
},
server: {
port: 3030
},
preview: {
port: 3000
}
}