const ENV = process.env.NODE_ENV;
const BUILD_ENV = process.env.BUILD_ENV;
const path = require("path");

const gameUrl = 'baccarat.eosget.io';

function getBaseUrl () {
    if (ENV === 'development') {
        return '/';
    } else if (BUILD_ENV === 'test') {
        return '/dist/';
    } else {
        let pre = BUILD_ENV === 'production' ? '' : `${BUILD_ENV}-`;
        return `https://static.meechat.me/cdn/${pre}${gameUrl}/dist/`;
    }
}

module.exports = {
    indexPath: ENV === 'production' ? '../protected/views/index.html' : 'index.html',
    outputDir: "../dist", //build 时生成的生产环境构建文件的目录
    baseUrl: getBaseUrl(),
    lintOnSave: false, //关闭eslint
    productionSourceMap: false, //生产环境取消source map
    css: {
        loaderOptions: {
            sass: {
                data: `@import "@/style/mixins.scss";`
            }
        }
    },
    configureWebpack: {
        resolve: {
            alias: {
                "@": path.join(__dirname, "src")
            }
        }
    }
};
