-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvue.config.js
64 lines (61 loc) · 1.65 KB
/
vue.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
/*
* @Author: Onedim941 [email protected]
* @Date: 2022-06-26 21:38:32
* @LastEditors: Onedim941 [email protected]
* @LastEditTime: 2022-10-11 18:40:56
* @FilePath: \vue3-cms-ts\vue.config.js
* @Description:
*/
// const path = require('path')
// const unpluginElementPlus = require('unplugin-element-plus/webpack')
// 自动按需导入elementui
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
module.exports = {
// 配置方式一: CLI提供的属性
outputDir: './build',
publicPath: './', // 加载资源路径 上线时不要使用
// 配置方式二: 和webpack属性完全一致。最后会进行合并
transpileDependencies: ['/@yabby-business/'],
configureWebpack: {
resolve: {
alias: {
components: '@/component'
}
},
plugins: [
AutoImport({
resolvers: [ElementPlusResolver()]
}),
Components({
resolvers: [ElementPlusResolver()]
})
]
},
devServer: {
// 配置跨域
proxy: {
'^/api': {
target: 'http://152.136.185.210:5000',
pathRewrite: {
'^/api': ''
},
changeOrigin: true
}
}
}
// 函数式配置
// configureWebpack: (config) => {
// config.resolv.alias = {
// "@": path.resolve(__dirname, "src"),
// components: "@/component"
// }
// }
// 配置方式三 链式
// chainWebpack: (config) => {
// config.resolve.alias
// .set('@', path.resolve(__dirname, 'src'))
// .set('component', '@/component')
// }
}