123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- /*
- * @Author: zouwenying
- * @Date: 2020-10-21 18:14:35
- * @LastEditTime: 2021-04-27 17:28:49
- * @LastEditors: zwy
- * @Description: In User Settings Edit
- * @FilePath: \vue-manage-system-master\vue.config.js
- */
- const path = require('path');
- const envConfig = require('./src/config');
- function resolve(dir) {
- return path.join(__dirname, dir); // path.join(__dirname)设置绝对路径
- }
- module.exports = {
- publicPath: '/sc-energyKb',
- productionSourceMap: false,
- lintOnSave: false,
- chainWebpack: config => {
- // 配置别名
- config.resolve.alias
- .set('@', resolve('src'))
- .set('@assets', resolve('src/assets'))
- .set('@views', resolve('src/views'))
- .set('@components', resolve('src/components'))
- .set('@utils', resolve('src/utils'));
- // 配置style px->vm
- // config.module
- // .rule('vue')
- // .test(/\.vue$/)
- // .use('style-vw-loader')
- // .loader('style-vw-loader')
- // .options({
- // viewportWidth: 1920,//传参
- // });
- // 配置每次打包浏览器缓存文件名的随机性
- // const filename = path.posix.join('js', `${new Date().getTime()}_[name].js`);
- // config.mode('production').devtool(false).output.filename(filename).chunkFilename(filename)
- },
- // // 配置全局样式变量
- // configureWebpack: {
- // externals: {
- // vue: 'Vue',
- // 'vue-router': 'VueRouter',
- // vuex: 'Vuex',
- // 'element-ui': 'ELEMENT',
- // axios: 'axios',
- // lodash: '_',
- // dayjs: 'dayjs',
- // echarts: 'echarts'
- // }
- // },
- devServer: {
- host: '0.0.0.0', // can be overwritten by process.env.HOST
- port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
- https: false, // https:{type:Boolean}
- open: false, // 配置自动启动浏览器 open: 'Google Chrome'-默认启动谷歌
- // 配置多个代理
- proxy: {
- '/sc-user-auth': {
- target: envConfig.baseApi,
- ws: true, // 代理的WebSockets
- changeOrigin: true, // 允许websockets跨域
- pathRewrite: {
- // "^/sc-user-auth": ""
- }
- },
- '/sc-user-center': {
- target: envConfig.baseApi,
- ws: true, // 代理的WebSockets
- changeOrigin: true, // 允许websockets跨域
- logLevel: 'debug',
- pathRewrite: {
- // "^/sc-user-center": ""
- }
- },
- '/sc-community': {
- target: envConfig.baseApi,
- ws: true, // 代理的WebSockets
- changeOrigin: true, // 允许websockets跨域
- logLevel: 'debug',
- pathRewrite: {
- // "^/sc-community": ""
- }
- },
- '/sc-message': {
- target: envConfig.baseApi,
- ws: true, // 代理的WebSockets
- changeOrigin: true, // 允许websockets跨域
- logLevel: 'debug',
- pathRewrite: {
- // "^/sc-message": ""
- }
- },
- '/sc-charge': {
- target: envConfig.baseApi,
- ws: true, // 代理的WebSockets
- changeOrigin: true, // 允许websockets跨域
- logLevel: 'debug',
- pathRewrite: {
- // "^/sc-charge": ""
- }
- },
- '/sc-energy': {
- target: envConfig.baseApi,
- ws: true, // 代理的WebSockets
- changeOrigin: true, // 允许websockets跨域
- logLevel: 'debug',
- pathRewrite: {
- // "^/sc-charge": ""
- }
- },
- '/operation-manager': {
- target: envConfig.baseApi,
- ws: true, // 代理的WebSockets
- changeOrigin: true, // 允许websockets跨域
- logLevel: 'debug',
- pathRewrite: {
- // "^/operation-manager": ""
- }
- },
- '/zoniot-water': {
- target: envConfig.baseApi,
- ws: true, // 代理的WebSockets
- changeOrigin: true, // 允许websockets跨域
- logLevel: 'debug',
- pathRewrite: {
- // "^/zoniot-water": ""
- }
- },
- }
- },
- };
|