123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- /*
- * @Author: zouwenying
- * @Date: 2020-10-21 18:14:35
- * @LastEditTime: 2021-03-25 17:03:31
- * @LastEditors: Please set LastEditors
- * @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: process.env.NODE_ENV == 'development' ? '/' : '/sc-login',
- productionSourceMap: 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'));
- },
- // 配置全局样式变量
- // css: {
- // loaderOptions: {
- // sass: {
- // prependData: `@import "@assets/css/variable.scss";`
- // }
- // }
- // },
- // 配置全局样式变量
- // css: {
- // loaderOptions: {
- // // sass: {
- // // data: '@import "@/assets/styles/common/px2rem.scss";@import "@/assets/styles/common/mixins.scss";'
- // // },
- // postcss: {
- // plugins: [
- // require('postcss-pxtorem')({
- // rootValue: 100, // 换算的基数
- // selectorBlackList: ['weui', 'mu'], // 忽略转换正则匹配项
- // propList: ['*']
- // })
- // ]
- // }
- // }
- // },
- configureWebpack: {
- externals: {
- vue: 'Vue',
- 'vue-router': 'VueRouter',
- vuex: 'Vuex',
- 'element-ui': 'ELEMENT',
- axios: 'axios',
- lodash: '_',
- dayjs: 'dayjs',
- echarts: 'echarts'
- },
- //关闭 webpack 的性能提示
- performance: {
- hints: 'warning',
- //入口起点的最大体积
- maxEntrypointSize: 50000000,
- //生成文件的最大体积
- maxAssetSize: 300000000,
- //只给出 js 文件的性能提示
- assetFilter: function (assetFilename) {
- return assetFilename.endsWith('.js');
- }
- }
- },
- 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跨域
- logLevel: 'debug',
- pathRewrite: {
- /* "^/api": "" */
- }
- },
- '/sc-user-center': {
- target: envConfig.baseApi,
- ws: true, // 代理的WebSockets
- changeOrigin: true, // 允许websockets跨域
- logLevel: 'debug',
- pathRewrite: {
- /* "^/api": "" */
- }
- },
- '/sc-community': {
- target: envConfig.baseApi,
- ws: true, // 代理的WebSockets
- changeOrigin: true, // 允许websockets跨域
- logLevel: 'debug',
- pathRewrite: {
- /* "^/api": "" */
- }
- },
- }
- }
- };
|