forked from FireFoxMsj/smartassistant-vue
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvue.config.js
84 lines (80 loc) · 2.28 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
const path = require('path')
const resolve = dir => path.join(__dirname, dir)
// 远程代理Ip
const baseUrl = 'http://192.168.22.123:9020'
// const baseUrl = 'http://192.168.22.69:37965'
// 输出文件夹 智能输出为dist 插件输出为yeelight
const outputDir = process.env.PLUGIN_NAME ? `./plugin/${process.env.PLUGIN_NAME}` : 'dist'
// const vConsole = require('vconsole-webpack-plugin')
module.exports = {
publicPath: './',
outputDir,
assetsDir: 'static',
lintOnSave: process.env.NODE_ENV === 'development',
productionSourceMap: false,
devServer: {
disableHostCheck: true,
overlay: {
warnings: false,
errors: true,
},
proxy: {
'/api': {
target: baseUrl,
changeOrigin: true,
pathRewrite: {
'^/api': '/api' // 本地加api
}
},
'/sc': {
target: 'http://192.168.22.123:9097',
changeOrigin: true,
pathRewrite: {
'^/sc': '/'
}
}
},
},
css: {
loaderOptions: {
// 默认情况下 `sass` 选项会同时对 `sass` 和 `scss` 语法同时生效
// 因为 `scss` 语法在内部也是由 sass-loader 处理的
// 但是在配置 `data` 选项的时候
// `scss` 语法会要求语句结尾必须有分号,`sass` 则要求必须没有分号
// 在这种情况下,我们可以使用 `scss` 选项,对 `scss` 语法进行单独配置
scss: {
prependData: '@import "src/styles/var.scss";'
}
}
},
configureWebpack: (config) => {
// provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
// config.plugins.push(
// // 手机端调试
// new vConsole({
// filter: [], // 需要过滤的入口文件
// enable: process.env.NODE_ENV !== 'production'// 生产环境不打开
// })
// )
Object.assign(config, {
// 开发生产共同配置
resolve: {
alias: {
'@': resolve('src')
}
}
})
},
chainWebpack: (config) => {
config
.plugin('html')
.tap((args) => {
const plugin = process.env.PLUGIN_NAME
if (plugin) {
args[0].template = `plugins/${plugin}/index.html`
}
return args
})
}
}