-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathwebpack.renderer.prod.js
82 lines (78 loc) · 2.38 KB
/
webpack.renderer.prod.js
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
71
72
73
74
75
76
77
78
79
80
81
82
/**
* Build config for electron renderer process
*/
import path from 'path';
import webpack from 'webpack';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import merge from 'webpack-merge';
import {
BundleAnalyzerPlugin,
} from 'webpack-bundle-analyzer';
import SentryCliPlugin from '@sentry/webpack-plugin';
import config from './webpack.renderer.base';
import pjson from './app/package.json';
const plugins = [
new HtmlWebpackPlugin({
template: 'app/renderer/index.tpl.html',
inject: 'body',
filename: 'index.html',
chunks: ['app'],
}),
new HtmlWebpackPlugin({
template: 'app/renderer/idlePopup.tpl.html',
inject: 'body',
filename: 'idlePopup.html',
chunks: ['idleTimePopup'],
}),
new HtmlWebpackPlugin({
template: 'app/renderer/attachmentWindow.tpl.html',
inject: 'body',
filename: 'attachmentWindow.html',
chunks: ['attachmentWindow'],
}),
new HtmlWebpackPlugin({
template: 'app/renderer/screenshotNotification.tpl.html',
inject: 'body',
filename: 'screenshotNotification.html',
chunks: ['screenshotNotificationPopup'],
}),
new HtmlWebpackPlugin({
template: 'app/renderer/screenshotsViewer.tpl.html',
inject: 'body',
filename: 'screenshotsViewer.html',
chunks: ['screenshotsViewerPopup'],
}),
new BundleAnalyzerPlugin({
analyzerMode: 'static',
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'),
'process.env.BABEL_ENV': JSON.stringify(process.env.BABEL_ENV || 'production'),
'process.env.DEBUG_PROD': JSON.stringify(process.env.DEBUG_PROD || 'false'),
'process.env.SENTRY_DSN': JSON.stringify(process.env.SENTRY_DSN),
'process.env.MIXPANEL_API_TOKEN': JSON.stringify(process.env.MIXPANEL_API_TOKEN),
'process.env.DISABLE_MIXPANEL': JSON.stringify(process.env.DISABLE_MIXPANEL),
}),
new SentryCliPlugin({
include: 'app/dist',
ignore: [
'node_modules',
'app/node_modules',
'*.html',
],
dryRun: process.env.SENTRY_DRY_RUN === 'true',
configFile: 'sentry.properties',
urlPrefix: 'app:///dist',
release: `${pjson.version}_${process.platform}`,
}),
];
module.exports = env => merge(config(env), {
mode: 'production',
devtool: 'source-map',
output: {
path: path.resolve(__dirname, 'app/dist'),
publicPath: './',
filename: '[name].prod.js',
},
plugins,
});