let UrlPrefixObj = require('./src/config/UrlPrefix.js')
const path = require("path");
function resolve(dir) {
    return path.join(__dirname, dir)
}
module.exports = {
    publicPath: "./", //相对路径
    outputDir: 'sy',
    configureWebpack: {
        performance: {
            hints: 'warning',
            // 入口起点的最大体积
            maxEntrypointSize: 50000000,
            // 生成文件的最大体积
            maxAssetSize: 30000000,
            // 只给出 js 文件的性能提示
            assetFilter: function (assetFilename) {
                return assetFilename.endsWith('.js')
            }
        },
    },
    chainWebpack(config) {
        //  set svg-sprite-loader
        config.module
          .rule('svg')
          .exclude.add(resolve('src/icons'))
          .end()
        config.module
          .rule('icons')
          .test(/\.svg$/)
          .include.add(resolve('src/icons'))
          .end()
          .use('svg-sprite-loader')
          .loader('svg-sprite-loader')
          .options({
              symbolId: 'icon-[name]'
          })
          .end()
        // less
    },
    devServer: {
        // port: port,
        open: true,
        proxy: {
            '^/api': {
                target: 'http://121.37.141.165:46790/',
                pathRewrite: {
                    '^/api': '',
                },
                changeOrigin: true,
            },
        },
    },

    pages: {
        index: UrlPrefixObj.model.INDEX
    }
};
