-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
77 lines (75 loc) · 2.11 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
75
76
77
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import checker from 'vite-plugin-checker'
import vueJsx from '@vitejs/plugin-vue-jsx'
import legacy from '@vitejs/plugin-legacy'
// import conditionalCompile from 'vite-plugin-conditional-compiler'
import { viteMockServe } from 'vite-plugin-mock'
import components from 'unplugin-vue-components/vite'
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'
import autoImport from 'unplugin-auto-import/vite'
import WindiCss from 'vite-plugin-windicss'
import emitReflectMetadata from './build/plugins/emit-reflect-metadata'
// @ts-ignore
import * as AntdComponents from './src/components/antd'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [
vue(),
emitReflectMetadata({ include: 'src/**/*.ts' }),
checker({
overlay: { initialIsOpen: false },
eslint: {
lintCommand:
'eslint --cache --max-warnings 0 --cache-location "node_modules/.cache/eslint/" "src/**/*.{vue,ts,tsx,js}"'
}
}),
vueJsx(),
legacy({
targets: ['defaults', 'not IE 11']
}),
// not necessary for now
// conditionalCompile(),
viteMockServe({
mockPath: 'src/mock',
enable: true,
logger: true,
watchFiles: true,
ignore: /(utils|data)\/.*/
}),
components({
resolvers: [AntDesignVueResolver()],
dts: 'src/components.d.ts',
dirs: undefined,
types: [
{ from: 'ant-design-vue', names: Object.keys(AntdComponents) },
{ from: '@form-create/ant-design-vue', names: ['form-create'] }
]
}),
autoImport({
eslintrc: { enabled: false, filepath: '.eslintrc-auto-import.json' },
include: [
/\.[tj]sx?$/, // .ts, .tsx, .js, .jsx
/\.vue$/,
/\.vue\?vue/,
/\.md$/ // .md
],
imports: ['vue', 'vue-router'],
dts: 'src/auto-imports.d.ts'
}),
WindiCss()
],
resolve: {
alias: [{ find: '@', replacement: '/src' }]
},
build: {
sourcemap: true
},
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true
}
}
}
})