vue.config.js 配置文件(卖茶叶项目的配置)

105 阅读1分钟
const path = require('path')

function resolve(dir) {
    return path.join(__dirname, dir)
}
module.exports = {
    // 设置跨域代理
    devServer: {
        proxy: {
            '/api': {
                target: 'http://localhost:3000',
                changeOrigin: true,
                pathRewrite: {
                    '^/api': '/api'
                }
            }
        },
    },
    // 设置访问路径以@开头查找
    configureWebpack: {
        resolve: {
            alias: {
                '@': resolve('src')
            }
        },
        // 要排除的包 key 是要排除的包名:value(实际上是实际引入的包的全局的变量名)
        // externals: externals
    },
}