const CompressionWebpackPlugin = require("compression-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
// const HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    // ...other vue-cli plugin options...
    outputDir: process.env.VUE_APP_ENV === 'TEST'?'NFT_TEST':'NFT',
    css: {
      loaderOptions: {
        less: {
            javascriptEnabled: true, // 加载LESS 需要把JS设置一下
            }
        }
      },
      devServer: {
        proxy: { // 设置代理
          '/proxyApi': {
            // target:process.env.VUE_APP_URL,
            // target: "http://192.168.20.251:8001",
            target: "http://146.56.218.121:12100",
            changeOrigin: true,
            pathRewrite: {
              '^/proxyApi': ''
            }
          },
          '/proxyDowload':{
            // target:"http://121.40.18.70:3001",
            target:"http://192.168.22.127:3001",
            changeOrigin: true,
            pathRewrite: {
              '^/proxyDowload': ''
            }
          }
        }
      },
      configureWebpack: {
        optimization: {
          minimize: process.env.VUE_APP_ENV === 'DEVELOPMENT'?false: true,
          minimizer: [
            new TerserPlugin({
              sourceMap: false,
              parallel: true,
            }),
          ],
        },
        plugins: [
          new CompressionWebpackPlugin(),
        ],
      },  
    // pwa: {
    //   name: 'My App',
    //   themeColor: '#4DBA87',
    //   msTileColor: '#000000',
    //   appleMobileWebAppCapable: 'yes',
    //   appleMobileWebAppStatusBarStyle: 'black',
    //   manifestOptions:{
    //     display: 'standalone',
    //     theme_color: '#333333'
    //   },
    //   // configure the workbox plugin
    //   workboxPluginMode: 'InjectManifest',
    //   workboxOptions: {
    //     // swSrc is required in InjectManifest mode.
    //     swSrc: 'dev/sw.js',
    //     // ...other Workbox options...
    //   }
    // }
  }