aboutsummaryrefslogtreecommitdiff
path: root/webpack.config.js
blob: 0c16db43ef86599696e74174bc288dbf42354df0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/* eslint-env node */

const path = require('path');
const dotenv = require('dotenv')
const webpack = require('webpack')

// this will update the process.env with environment variables in .env file
dotenv.config();

module.exports = {
  entry: {
    ui: './webAO/ui.js',
    client: './webAO/client.js',
    master: './webAO/master.js'
  },
  devtool: 'source-map',
  devServer: {
    static: {
      directory: path.join(__dirname, 'webAO'),
    },
    compress: true,
    port: 8080,
  },
  mode: 'production',
  module: {
    rules: [
      {
        test: /\.m?js$/,
        exclude: /(node_modules|bower_components)/,
        use: {
          loader: 'babel-loader',
          options: {
            presets: [
              [
                '@babel/preset-env', {
                  useBuiltIns: 'usage',
                  targets: [
                    "defaults",
                    "Safari > 3",
                    "Opera > 8",
                    "Android > 3"
                  ],
                  corejs: 3
                }
              ]
            ]
          }
        }
      }
    ]
  },
  output: {
    path: path.resolve(__dirname, 'webAO'),
    filename: '[name].b.js'
  },
  performance: {
    hints: false,
    maxEntrypointSize: 512000,
    maxAssetSize: 512000
  }, 
  plugins: [
    new webpack.DefinePlugin({
      'process.env': JSON.stringify(process.env)
    })
  ],

};