const CompressionWebpackPlugin = require("compression-webpack-plugin");
const TerserPlugin = require("terser-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://' + "124.71.183.184:8093",
            changeOrigin: true,
            pathRewrite: {
              '^/proxyApi': ''
            }
          }
        }
      },
      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...
    //   }
    // }
  }