Blame view

config/electron/webpack.renderer.common.js 1.51 KB
05b0b5d8   Yarik   first commit
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
68
69
70
  const helpers = require('./../helpers');
  const HtmlWebpackPlugin = require('html-webpack-plugin');
  
  const METADATA = {
    baseUrl: './',
    ENV: 'renderer'
  };
  
  /*
   * Webpack configuration
   *
   * See: http://webpack.github.io/docs/configuration.html#cli
   */
  module.exports = function (env) {
    METADATA.ENV = env
      ? env
      : METADATA.ENV;
  
    return {
  
      /**
       * The plataform target where the aplication is going to run in.
       * It support target electron-renderer, but is not documented.
       *
       * See: https://webpack.github.io/docs/configuration.html#target
       */
  
      target: 'electron-renderer',
  
      /**
       * Options affecting the output of the compilation.
       *
       * See: http://webpack.github.io/docs/configuration.html#output
       */
      output: {
  
        /**
         * The output directory as absolute path (required).
         *
         * See: http://webpack.github.io/docs/configuration.html#output-path
         */
        path: helpers.root('build')
      },
  
      /*
      * Include polyfills or mocks for various node stuff
      * Description: Node configuration
      *
      * See: https://webpack.github.io/docs/configuration.html#node
      */
      node: {
        global: true,
        crypto: 'empty',
        process: true,
        module: false,
        clearImmediate: false,
        setImmediate: false
      },
  
      plugins: [
        new HtmlWebpackPlugin({
          template: 'src/index.html',
          title: METADATA.title,
          chunksSortMode: 'dependency',
          metadata: METADATA,
          inject: 'head'
        })
      ]
    };
  };