-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvue.config.js
More file actions
71 lines (69 loc) · 1.77 KB
/
vue.config.js
File metadata and controls
71 lines (69 loc) · 1.77 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
/*
const path = require('path')
module.exports = {
// 部署应用包时的基本 URL,用法和 webpack 本身的 output.publicPath 一致
publicPath: './',
// 输出文件目录
outputDir: 'dist',
// eslint-loader 是否在保存的时候检查
lintOnSave: true,
// 是否使用包含运行时编译器的 Vue 构建版本
runtimeCompiler: false,
// 生产环境是否生成 sourceMap 文件
productionSourceMap: false,
// 生成的 HTML 中的 <link rel="stylesheet"> 和 <script> 标签上启用 Subresource Integrity (SRI)
integrity: false,
// webpack相关配置
chainWebpack: (config) => {
config.resolve.alias
.set('vue$', 'vue/dist/vue.esm.js')
.set('@', path.resolve(__dirname, './src'))
},
configureWebpack: (config) => {
if (process.env.NODE_ENV === 'production') {
// 生产环境
config.mode = 'production'
} else {
// 开发环境
config.mode = 'development'
}
},
// css相关配置
css: {
// 是否分离css(插件ExtractTextPlugin)
extract: true,
// 是否开启 CSS source maps
sourceMap: false,
// css预设器配置项
loaderOptions: {},
// 是否启用 CSS modules for all css / pre-processor files.
modules: false
},
// 是否使用 thread-loader
parallel: require('os').cpus().length > 1,
// PWA 插件相关配置
pwa: {},
// webpack-dev-server 相关配置
devServer: {
open: true,
host: 'localhost',
port: 8080,
https: false,
hotOnly: false,
// http 代理配置
proxy: {
'/api': {
target: 'http://127.0.0.1:3000/api',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
},
before: (app) => {}
},
// 第三方插件配置
pluginOptions: {
}
}
*/