-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathvite.config.ts
76 lines (75 loc) · 2 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
import { resolve } from 'path'
import { defineConfig } from 'vite'
import { quasar, transformAssetUrls } from '@quasar/vite-plugin'
import vue from '@vitejs/plugin-vue'
import Unocss from 'unocss/vite'
import Pages from 'vite-plugin-pages'
import Layouts from 'vite-plugin-vue-layouts'
import { presetUno } from 'unocss'
import VueI18n from '@intlify/vite-plugin-vue-i18n'
export default defineConfig({
plugins: [
vue({ template: { transformAssetUrls } }),
quasar({ sassVariables: 'src/styles/variables.sass' }),
Pages({
nuxtStyle: true,
dirs: [
{ dir: 'src/pages', baseRoute: '' },
{ dir: 'src/pages/blank', baseRoute: '' },
],
}),
Layouts(),
Unocss({
presets: [presetUno()],
}),
VueI18n({
include: resolve(__dirname, 'src/locales/**'),
}),
],
resolve: {
alias: {
src: resolve(__dirname, 'src'),
'~': resolve(__dirname, 'src'),
},
},
server: {
https: false,
port: 3000,
proxy: {
'/api': {
target: 'http://localhost:8600',
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^\/api/, ''),
},
'/v2/api': {
target: 'http://localhost:9000',
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^\/v2\/api/, ''),
},
'/v3/api': {
target: 'http://localhost:8090',
changeOrigin: true,
secure: false,
rewrite: (path) => path.replace(/^\/v3\/api/, ''),
},
},
},
build: {
// reportCompressedSize: true,
chunkSizeWarningLimit: 1024,
rollupOptions: {
output: {
manualChunks(id) {
if (id.includes('/node_modules/')) {
//设置需要独立打包的npm包
const modules = ['quasar', '@quasar', 'vue', '@vue']
const chunk = modules.find((module) => id.includes(`/node_modules/${module}`))
return chunk ? `vendor-${chunk}` : 'vendor'
}
},
},
},
},
})