-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvite.config.js
78 lines (75 loc) · 2.26 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
import {resolve} from "path";
import {defineConfig} from "vite";
import { SchemaOrg } from '@vueuse/schema-org-vite'
import { URL, fileURLToPath } from 'node:url'
import vue from "@vitejs/plugin-vue";
export default defineConfig({
plugins: [
vue(),
//antd introduces configuration on demand
SchemaOrg({
// Note: mocking is disable as it's expiremental
mock: false,
// use simple types
full: false,
// write type alias to tsconfig.json
dts: false,
}),
],
resolve: {
//Path alias configuration
alias: {
//"@": resolve(__dirname, ".", "src"),
'@': fileURLToPath(new URL('./src', import.meta.url)),
components: resolve(__dirname, "src/components/"),
constants: resolve(__dirname, "src/constants/"),
find: /^~/,
replacement: '',
img: resolve(__dirname, "assets/img"),
services: resolve(__dirname, "src/services/"),
src: resolve(__dirname, "src"),
store: resolve(__dirname, "src/store/"),
styles: resolve(__dirname, "assets/styles/"),
svgs: resolve(__dirname, "src/assets/svgs/"),
},
mainFields: ["module"],
//File suffix name that needs to be omitted Note: If an ignored suffix name is configured here, an error will be reported if it is imported with a suffix name
extensions: [".vue", ".js"]
},
// Mandatory pre-built plugin package
optimizeDeps: {
include: [
'vue-cal/dist/vuecal.common.js',
],
},
css: {
loaderOptions: {
less: {
lessOptions: {
javascriptEnabled: true
}
}
},
modules: true,
},
// Package configuration
build: {
target: "modules",
outDir: "dist", //Specify the output path
assetsDir: "assets", // Specify the storage path of the generated static resources
minify: "terser" // obfuscator, the file size is smaller after terser is built
},
// Local running configuration, and reverse proxy configuration
server: {
cors: true, // enable by default and allow any source
open: true, // automatically open the application in the browser when the server starts
// Reverse proxy configuration, pay attention to the writing of rewrite, I did not read the document at the beginning, I stepped on the pit here
proxy: {
"/api": {
target: "http://localhost:9091", //Proxy interface
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, "")
}
}
}
});