-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathvite.config.js
More file actions
89 lines (88 loc) · 2.36 KB
/
vite.config.js
File metadata and controls
89 lines (88 loc) · 2.36 KB
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
import { defineConfig } from 'vite';
import path from 'path';
import vue from '@vitejs/plugin-vue2'
import envCompatible from 'vite-plugin-env-compatible';
// import { createHtmlPlugin } from 'vite-plugin-html';
import { viteCommonjs } from '@originjs/vite-plugin-commonjs';
import inject from '@rollup/plugin-inject'
import nodeStdlibBrowser from 'node-stdlib-browser'
import { createStyleImportPlugin, VantResolve } from 'vite-plugin-style-import'
import { VitePWA } from 'vite-plugin-pwa'
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: { '@': path.resolve(__dirname, 'src'), ...nodeStdlibBrowser },
extensions: [
'.mjs',
'.js',
'.ts',
'.jsx',
'.tsx',
'.json',
'.vue'
]
},
plugins: [
vue(),
viteCommonjs(),
envCompatible(),
{
...inject({
global: [require.resolve('node-stdlib-browser/helpers/esbuild/shim'), 'global'],
process: [require.resolve('node-stdlib-browser/helpers/esbuild/shim'), 'process'],
Buffer: [require.resolve('node-stdlib-browser/helpers/esbuild/shim'), 'Buffer'],
}),
enforce: 'post',
},
createStyleImportPlugin({ // 按需导入vant组件插件,解决vant按需导入样式丢失的问题
resolves: [VantResolve()],
}),
VitePWA({ registerType: 'autoUpdate' })
// createHtmlPlugin({
// // template: "./index.html",
// inject: {
// data: {
// title: 'buzz-bit'
// }
// }
// })
],
server: {
port: 8080,
// https: true,
strictPort: false,
proxy: {
'/showMANDB': {
target: 'https://api.showmoney.app',
changeOrigin: true
},
'/metaaccess': {
target: 'https://api.showmoney.app',
changeOrigin: true
},
'/aggregation/v2/app/show/': {
target: 'https://api.show3.io',
changeOrigin: true
},
'/aggregation/v2/': {
target: 'https://api.showmoney.app',
changeOrigin: true
},
'/showpaycore/api/': {
target: 'https://api.showmoney.app',
changeOrigin: true
},
'/serviceapi/': {
target: 'https://api.showmoney.app',
changeOrigin: true
},
'/oauth2/': {
target: 'https://www.showmoney.app',
changeOrigin: true
}
}
},
build: {
sourcemap: false
}
})