const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');

module.exports = {
  outputDir: '../frontend',
  devServer: {
    proxy: {
      '/': {
        target: 'http://localhost:5000',
        changeOrigin: true,
        secure: false
      }
    }
  },
  chainWebpack: config => {
    if (config.optimization.minimizers.has('css')) {
      config.optimization.minimizer('css')
        .use(CssMinimizerPlugin, [{
          minimizerOptions: {
            preset: ['default', {
              discardUnused: false,
              reduceTransforms: false,
              normalizeUnicode: false,
              uniqueSelectors: false
            }]
          }
        }]);
    }
  }
};