forked from opentiny/tiny-vue-playground
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.ts
53 lines (51 loc) · 1.26 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
import path from 'node:path'
import fs from 'node:fs'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import UnoCSS from 'unocss/vite'
import { presetAttributify, presetIcons, presetUno } from 'unocss'
import Components from 'unplugin-vue-components/vite'
import Inspect from 'vite-plugin-inspect'
const pathSrc = path.resolve(__dirname, 'src')
// https://vitejs.dev/config/
export default defineConfig({
base: './',
resolve: {
alias: {
'@': pathSrc
}
},
plugins: [
vue({
script: {
defineModel: true,
propsDestructure: true,
fs: {
fileExists: fs.existsSync,
readFile: (file) => fs.readFileSync(file, 'utf-8')
}
}
}),
Components({
dirs: [path.resolve(pathSrc, 'components')],
dts: path.resolve(pathSrc, 'components.d.ts')
}),
UnoCSS({
presets: [presetUno(), presetAttributify(), presetIcons()]
}),
Inspect()
],
define: {
'process.env': { ...process.env },
'process.platform': '""'
},
optimizeDeps: {
exclude: ['@vue/repl']
},
build: {
rollupOptions: {
external: ['typescript']
}
// outDir: path.resolve(__dirname, '../dist') // 设置打包输出的目录,这里设置为 dist 目录
}
})