This repository has been archived by the owner on Jun 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 120
/
vue.config.js
104 lines (96 loc) · 3.51 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
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
const path = require('path')
const webpack = require('webpack')
const resolve = dir => {
console.log(path.join(__dirname, dir))
return path.join(__dirname, dir)
}
// 项目部署基础
// 默认情况下,我们假设你的应用将被部署在域的根目录下,
// 例如:https://www.my-app.com/
// 默认:'/'
// 如果您的应用程序部署在子路径中,则需要在这指定子路径
// 例如:https://www.foobar.com/my-app/
// 需要将它改为'/my-app/'
// iview-admin线上演示打包路径: https://file.iviewui.com/admin-dist/
const BASE_URL = process.env.NODE_ENV === 'production'
? '/mouseinc'
: '/'
let configureWebpack = {}
// const externals = {
// 'vue': 'Vue',
// 'vue-router': 'VueRouter',
// 'vuex': 'Vuex',
// 'vue-i18n': 'VueI18n',
// 'axios': 'axios',
// 'js-beautify': 'beautifier',
// 'view-design': 'iview',
// 'codemirror': 'codemirror',
// 'vue-codemirror': 'VueCodemirror'
// }
// if (process.env.NODE_ENV === 'production') {
// configureWebpack.externals = externals
// }
// configureWebpack.externals = externals
configureWebpack.plugins = [
new webpack.optimize.MinChunkSizePlugin({
minChunkSize: 102400
})
]
// const cdn = {
// css: [
// 'https://cdn.jsdelivr.net/npm/view-design/dist/styles/iview.css',
// 'https://cdn.jsdelivr.net/npm/codemirror/lib/codemirror.css'
// ],
// js: [
// 'https://cdn.jsdelivr.net/npm/vue/dist/vue.min.js',
// 'https://cdn.jsdelivr.net/npm/vue-router/dist/vue-router.min.js',
// 'https://cdn.jsdelivr.net/npm/vuex/dist/vuex.min.js',
// 'https://cdn.jsdelivr.net/npm/vue-i18n/dist/vue-i18n.min.js',
// 'https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js',
// 'https://cdn.jsdelivr.net/npm/js-beautify/js/lib/beautifier.min.js',
// 'https://cdn.jsdelivr.net/npm/view-design/dist/iview.min.js',
// 'https://cdn.jsdelivr.net/npm/codemirror/lib/codemirror.js',
// 'https://cdn.jsdelivr.net/npm/codemirror/mode/javascript/javascript.js',
// 'https://cdn.jsdelivr.net/npm/codemirror/addon/selection/active-line.js',
// 'https://cdn.jsdelivr.net/npm/vue-codemirror/dist/vue-codemirror.min.js'
// ]
// }
module.exports = {
// Project deployment base
// By default we assume your app will be deployed at the root of a domain,
// e.g. https://www.my-app.com/
// If your app is deployed at a sub-path, you will need to specify that
// sub-path here. For example, if your app is deployed at
// https://www.foobar.com/my-app/
// then change this to '/my-app/'
publicPath: BASE_URL,
// tweak internal webpack configuration.
// see https://github.com/vuejs/vue-cli/blob/dev/docs/webpack.md
// 如果你不需要使用eslint,把lintOnSave设为false即可
lintOnSave: true,
configureWebpack,
chainWebpack: config => {
config.optimization.delete('splitChunks')
// config
// .plugin('html')
// .tap(args => {
// if (process.env.NODE_ENV === 'production') {
// args[0].cdn = cdn
// }
// args[0].cdn = cdn
// return args
// })
config.resolve.alias
.set('@', resolve('src')) // key,value自行定义,比如.set('@@', resolve('src/components'))
.set('_c', resolve('src/components'))
},
css: {
extract: false
},
// 设为false打包时不生成.map文件
productionSourceMap: false
// 这里写你调用接口的基础路径,来解决跨域,如果设置了代理,那你本地开发环境的axios的baseUrl要写为 '' ,即空字符串
// devServer: {
// proxy: 'localhost:3000'
// }
}