zoukankan      html  css  js  c++  java
  • vue.config.js

    const path = require("path");
    const resolve = function(dir) {
        return path.join(__dirname, dir);
    };
    module.exports = {
        publicPath: "./",
        outputDir: "dist",
        assetsDir: "static",
        lintOnSave: false, // 是否开启eslint保存检测
        productionSourceMap: false, // 是否在构建生产包时生成sourcdeMap
        chainWebpack: config => {
            config.resolve.alias
                .set("@", resolve("src"))
                .set("@", resolve("src/views"))
                .set("@", resolve("src/components"))
                .set("@", resolve("src/common"))
                .set("@", resolve("src/utils"))
                .set("@", resolve("src/service")); /* 别名配置 */
            config.optimization.runtimeChunk("single");
        },
        devServer: {
            // host: "localhost",
            /* 本地ip地址 */
            host: "localhost",
            port: "10000",
            hot: true,
            /* 自动打开浏览器 */
            open: true,
            overlay: {
                warning: false,
                error: true
            },
            /* 跨域代理 */
            proxy: {
                "/item": {
                    /* 目标代理服务器地址 */
                    target: "http://localhost:80", //localhost:80/api/item/category/list
                    // target: "http://192.168.1.102:8888", //
                    /* 允许跨域 */
                    changeOrigin: true,
                    ws: true,
                    pathRewrite: {
                        "^/item": "/api/item"
                    }
                },
                "/upfile": {
                    /* 目标代理服务器地址 */
                    target: "http://localhost:80", //localhost:80/api/item/category/list
                    // target: "http://192.168.1.102:8888", //
                    /* 允许跨域 */
                    changeOrigin: true,
                    ws: true,
                    pathRewrite: {
                        "^/upfile": "/api/upfile"
                    }
                },
                /*"/upload": {
                    /!* 目标代理服务器地址 *!/
                    target: "http://localhost:8082", //localhost:80/api/item/category/list
                    // target: "http://192.168.1.102:8888", //
                    /!* 允许跨域 *!/
                    changeOrigin: true,
                    ws: true,
                    pathRewrite: {
                        "^/upload": "/upload"
                    }
                },*/
            }
    
        }
    };
  • 相关阅读:
    LVS+keepalived DR模式配置 实现高可用集群
    lamp+redis集群配置详解
    Centos7.4+Mariadb集群-主从配置介绍
    centos6.5 LVS-DR模式---全内网环境
    Cacti安装使用&流量监控详解
    纯CSS模拟安卓滑动开关
    Java静态泛型方法使用例子-工具类
    基于KaliLinux的GNOME美化
    ArchLinux安装笔记
    [笔记] SpringMVC+Mybatis搭建Web开发环境
  • 原文地址:https://www.cnblogs.com/yscec/p/12254875.html
Copyright © 2011-2022 走看看