const path = require('path')
// const HtmlWebpackPlugin = require('html-webpack-plugin')
module.exports = {
  mode: 'production',
  devtool: 'source-map',
  entry: ['babel-polyfill', path.resolve(__dirname, './src/index.js')],
  output: {
    filename: 'main.js',
    path: path.resolve(__dirname, 'dist'),
  },
  module: {
    rules: [
      {
        test: /\.m?js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: ['@babel/preset-env'],
          },
        },
      },
    ],
  },
  // plugins: [new HtmlWebpackPlugin()],
  devServer: {
    contentBase: path.join(__dirname, 'dist'),
    compress: true,
    port: 9000,
    proxy: {
      '/create': {
        target: 'http://test-api-xpay.yy.com/api/v1/payment_orders',
        changeOrigin: true,
      },
    },
  },
}
