vue垮域问题,打包大小报错,访问css文件错误处理

云游道人 2025-03-19 78 阅读 0评论

在vue.config.js下配置

// vue.config.js

module.exports = {

    publicPath: './',   //配置访问静态文件路径

    outputDir: 'dist',  //打包存放目录

    devServer: {

        //port: 9999, //配置本地服务端口

        //配置代理服务器

        proxy: {

            //当检测到路径中存在 /api 进入代理服务器

            '/api': {

                target: 'http://www.xxapid.com', // 目标服务器的地址

                changeOrigin: true, //允许垮域

                secure:false,//如果是 https 接口,需要配置这个参数

                //将路径中的 /api 替换成空字符串

                pathRewrite: {

                    '^/api': ''   // 可以根据需要重写路径

                }

            }

        }

    },

    configureWebpack: config => {

        // 为生产环境修改配置...

        if (process.env.NODE_ENV === 'production') {

            config.mode = 'production';

            // 打包文件大小配置

            config.performance = {

              maxEntrypointSize: 10000000,

              maxAssetSize: 30000000

            }

        }

    },

  }

发表评论

快捷回复: 表情:
Addoil Applause Badlaugh Bomb Coffee Fabulous Facepalm Feces Frown Heyha Insidious KeepFighting NoProb PigHead Shocked Sinistersmile Slap Social Sweat Tolaugh Watermelon Witty Wow Yeah Yellowdog
提交
评论列表 (有 0 条评论, 78人围观)