const { defineConfig } = require('@vue/cli-service')
const baseUrl = require('./src/utils/baseUrl.js')
module.exports = defineConfig({
    transpileDependencies: true,
    lintOnSave: false,
    // baseUrl: BASE_URL,
    // chainWebpack: config => {
    //     config.resolve.alias
    //         .set('@', resolve('src'))
    //         .set('_c', resolve('src/components'))
    //         .set('_conf', resolve('config'))
    // },
    publicPath: '/',
    configureWebpack: {
        externals: {
            'fs': require('fs')
        }
    },
    devServer: {
        port: 8090,
        proxy: process.env.NODE_ENV === "development" ? {
            [baseUrl.ROOT]: {
                target: baseUrl.URL,
                // target: 'http://192.168.2.4:8086',
                changeOrigin: true,
                ws: false,
                pathRewrite: {
                    // '^/api': ''
                    [`^${baseUrl.ROOT}`]: ''
                }
            }
            // '/api': {
            //     target: 'http://120.46.129.85:8086',
            //     // target: 'http://192.168.2.4:8086',
            //     changeOrigin: true,
            //     ws: false,
            //     pathRewrite: {
            //         '^/api': ''
            //     }
            // }
        } : baseUrl.ROOT
    }
})

