1
0
Fork 0
5g-track/vue.config.js

50 lines
1.8 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict'
const path = require('path')
const resolve = dir => path.join(__dirname, dir)
const titleName = '5G 赛道' // 页面默认title在路由中被覆盖刚进入页面路由之前会展示这一段之后会被路由中的逻辑覆盖
const port = process.env.VUE_APP_BASE_PORT || process.env.npm_config_port || 8088 // dev port 端口号
module.exports = {
publicPath: process.env.NODE_ENV === "production" ? "./" : "/", //生产环境改成相对路径
outputDir: 'dist',
assetsDir: 'static', //打包后其他静态资源所在文件夹
productionSourceMap: false, //设置成false加快打包速度同时放弃生产环境的镜像map也就是不能准确定位报错行数
devServer: {
port: port,
open: true,
proxy: {
[process.env.VUE_APP_BASE_API]: {
target: `http://5gmalasong.hnabc.cn`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
}
}
},
},
configureWebpack: {
name: titleName, //在index.html中可通过webpackConfig.name使用
resolve: {
alias: {
'@': resolve('src'),
'components': resolve('src/components'),
'globalComponents':resolve('src/globalComponents'),
'utils':resolve('src/utils'),
'assets':resolve('src/assets'),
'api':resolve('src/api'),
'styles':resolve('src/styles'),
}
}
},
css: {
loaderOptions: {
// 给 stylus-loader 传递选项,使得指定stylus公共变量可以全局使用
stylus: {
import: ['~@/styles/variables.styl']
}
}
}
}