-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvite.config.js
99 lines (98 loc) · 2.68 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import Icons from 'unplugin-icons/vite'
// import basicSsl from '@vitejs/plugin-basic-ssl'
import Unocss from 'unocss/vite'
import { PrimeVueResolver } from '@primevue/auto-import-resolver'
// https://vitejs.dev/config/
export default ({ mode }) => {
// const env = loadEnv(mode, process.cwd())
return defineConfig({
base: './',
build: {
outDir: 'dist',
sourcemap: false,
minify: true,
emptyOutDir: true,
rollupOptions: {
output: {
chunkFileNames: 'js/[hash].js',
entryFileNames: 'js/[hash].js',
assetFileNames: (assetsFile) => {
if (/\.(vue|scss)$/i.test(assetsFile.name)) {
return 'del/[name]-[hash].[ext]'
} else {
return 'static/[hash].[ext]'
}
}
}
}
},
plugins: [
vue(),
vueJsx(),
// basicSsl(),
Unocss({}),
AutoImport({
imports: [
'vue',
'vue-router',
'pinia',
'@vueuse/core',
{
'@/api': ['useRequest']
},
{
'@/locales': ['useI18n', 'locale']
}
],
eslintrc: {
enabled: false, // Default `false`
filepath: './.eslintrc-auto-import.json', // Default `./.eslintrc-auto-import.json`
globalsPropValue: true // Default `true`, (true | false | 'readonly' | 'readable' | 'writable' | 'writeable')
}
}),
Components({
dirs: ['src/components'],
dts: false,
resolvers: [PrimeVueResolver()],
include: [/\.vue$/, /\.vue\?vue/, /\.jsx$/]
}),
Icons({
compiler: 'vue3'
})
],
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
assets: path.resolve(__dirname, 'src/assets'),
util: path.resolve(__dirname, 'src/util'),
views: path.resolve(__dirname, 'src/views'),
layout: path.resolve(__dirname, 'src/layout'),
'vue-i18n': 'vue-i18n/dist/vue-i18n.cjs.js'
}
},
preprocessorOptions: {
scss: {
// additionalData: `@import "@/assets/base.scss";`
}
},
define: {
__DEV__: mode === 'development',
__TEST__: mode === 'test'
}
// server:{
// proxy:{
// '/alarm':{
// target: 'https://127.0.0.1',
// changeOrigin: true,
// rewrite: (path) => path.replace(/^api/, ''),
// }
// }
// }
})
}