-
Notifications
You must be signed in to change notification settings - Fork 0
/
vue.config.js
64 lines (63 loc) · 1.54 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
const path = require('path')
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
module.exports = {
// 1.配置方式一: CL提供的属性
outputDir: './build',
// 本地测试时打开
// publicPath: './',
// 2.和webpack的模式一致,然后合并到webpack代码中
// 2.1
devServer: {
proxy: {
'^/api': {
target: 'http://152.136.185.210:5000',
pathRewrite: {
'^/api': ''
},
changeOrigin: true
}
}
},
configureWebpack: {
resolve: {
alias: {
'@': path.resolve(__dirname, 'src'),
components: '@/components'
}
},
// element-plus引入方式
plugins: [
AutoImport({
resolvers: [ElementPlusResolver()]
}),
Components({
resolvers: [ElementPlusResolver()]
})
],
// elementplus和webpack兼容问题
// https://www.cnblogs.com/zyfenblog/p/15870740.html
module: {
rules: [
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto'
}
]
}
}
// 2.2
// configureWebpack: (config) => {
// config.resolve.alias = {
// '@': path.resolve(__dirname, 'src'),
// components: '@/components'
// }
// }
// chainWebpack: (config) => {
// config.resolve.alias
// .set('@', path.resolve(__dirname, 'src'))
// .set('components', '@/components')
// },
}