summaryrefslogtreecommitdiff
path: root/electron/service/config/renderer.js
blob: cf3fab01ad6b150d1e41db308614f602973424ac (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
'use strict'

const { merge } = require('webpack-merge')
const TerserPlugin = require('terser-webpack-plugin')

const baseWebpackConfig = require('./base')
const cssWebpackConfig = require('./css')
const config = require('../project.config')
const terserOptions = require('./terserOptions')

module.exports = merge(baseWebpackConfig, cssWebpackConfig, {
  mode: 'production',
  entry: {
    renderer: './src/renderer/main.js',
  },

  output: {
    publicPath: config.build.publicPath,
  },

  optimization: {
    minimize: true,
    minimizer: [new TerserPlugin(terserOptions())],
    moduleIds: 'deterministic',
    moduleIds: 'named',
     splitChunks: {
      cacheGroups: {
        defaultVendors: {
          name: `chunk-vendors`,
          test: /[\\/]node_modules[\\/]/,
          priority: -10,
          chunks: 'initial',
        },
        common: {
          name: `chunk-common`,
          minChunks: 2,
          priority: -20,
          chunks: 'initial',
          reuseExistingChunk: true,
        },
      },
    },
  },
  target: ['electron-renderer'],
})