const CompressionWebpackPlugin = require('compression-webpack-plugin');

module.exports = {
    lintOnSave:false,
    devServer: {
        open: true,
        // proxy: {
        //     "/api": {
        //         target: "http://47.98.157.120:9031/",
        //         changeOrigin: true,
        //         // pathRewrite: {
        //         //     "^/api": "/"
        //         // }
        //     }
        // }
    },
    productionSourceMap: false,
    transpileDependencies: ['element-ui'],  // 需要兼容IE10要放开这个
    chainWebpack: config => {
        config.plugin('html').tap(options => {
            options[0].title = '经发局考核管理系统';
            return options;
        });
        if (process.env.NODE_ENV === 'production') {
            config.plugin('compressionPlugin').use(new CompressionWebpackPlugin({
                test: /\.(js|css|less)$/,
                threshold: 10240,  // 对超过10kb的文件压缩
                deleteOriginalAssets: false
            }));
        }
    }
}