webpack.config.js 924 Bytes
Newer Older
Ivan Bogatyy's avatar
Ivan Bogatyy committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

const dist_path = '/code/src';

module.exports = {
  context: '/code',
  entry: './src/visualize.js',
  output: {path: dist_path, filename: 'bundle.js'},
  devServer: {
    contentBase: dist_path,
    // We use Docker for host restriction (see develop.sh's -p argument to
    // the `docker run` invocation). Due to how Docker munges host names, this
    // can't be restricted to localhost.
    host: '0.0.0.0',
    port: 9000,
  },
  module: {
17
    rules: [{
Ivan Bogatyy's avatar
Ivan Bogatyy committed
18
19
      // Uses some new-style (ECMA 2015) classes ... compile them out.
      test: /\.jsx?$/,
20

Ivan Bogatyy's avatar
Ivan Bogatyy committed
21
      exclude: /node_modules/,
22
23
24
25
26
27
28
29
30
31
32
33

      use: [{
        loader: 'babel-loader',

        options: {
          presets: [['@babel/preset-env', {targets: 'cover 99.5%'}]],
          plugins: [
            '@babel/plugin-proposal-object-rest-spread',
            ['@babel/plugin-transform-react-jsx', {'pragma': 'preact.h'}],
          ],
        }
      }]
Ivan Bogatyy's avatar
Ivan Bogatyy committed
34
35
36
37
    }]
  }
};