/*
 * @Descripttion: 
 * @version: 
 * @Author: wt
 * @Date: 2023-02-17 11:09:01
 * @LastEditors: wt
 * @LastEditTime: 2023-02-17 11:24:46
 */
const path = require('path')

function resolve(dir) {
    return path.join(__dirname, dir);
}
// 基本结构
module.exports = {
    // 打包后路径错误导致的空白页面问题。
    // publicPath: '/vuefiv/',
    // publicPath: '/panel/',
    publicPath: '/backStage/',
    outputDir: process.env.outputDir,
    // assetsPublicPath: '/vuefiv/',
    // assetsDir: 'vuefiv',
    //      *  分别为生成环境和开发环境配置
    configureWebpack: config => {
        if (process.env.NODE_ENV === 'production') {
            // 为生产环境修改配置...
            config.optimization.minimizer[0].options.terserOptions.compress.drop_console = true
        } else {
            // 为开发环境修改配置...
        }
        Object.assign(config, {
            externals: {
                'AMap': 'AMap',
                'AMapUI': 'AMapUI'
            },
            resolve: {
                extensions: ['.js', '.vue', '.json'],
                alias: {
                    '@': resolve('src'),
                    '~': process.cwd(),
                    public: resolve('public'),
                    components: resolve('src/components'),
                    util: resolve('src/utils'),
                    store: resolve('src/store'),
                    router: resolve('src/router')
                }
            },
        })
    },
    devServer: {

        hot: true, //自动保存
        proxy: {
            // '/vuefiv/': {
            './backStage/': {
                // target: 'https://qhome.usky.cn/fivapi',
                target: 'http://172.16.120.165:8011',

                ws: false,
                changeOrigin: true,
                pathRewrite: {
                    '^./': './'
                }
            }
        },
        public: 'localhost:8080/backStage/'
    }
}