forked from Opentrons/opentrons
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
36 lines (31 loc) · 1020 Bytes
/
webpack.config.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
'use strict'
const path = require('path')
const webpackMerge = require('webpack-merge')
const { DefinePlugin } = require('webpack')
const { nodeBaseConfig } = require('@opentrons/webpack-config')
const pkg = require('./package.json')
const ENTRY_MAIN = path.join(__dirname, 'src/main.ts')
const ENTRY_PRELOAD = path.join(__dirname, 'src/preload.ts')
const OUTPUT_PATH = path.join(__dirname, 'lib')
const COMMON_CONFIG = {
output: { path: OUTPUT_PATH },
plugins: [
new DefinePlugin({
_PKG_VERSION_: JSON.stringify(pkg.version),
_PKG_PRODUCT_NAME_: JSON.stringify(pkg.productName),
_PKG_BUGS_URL_: JSON.stringify(pkg.bugs.url),
}),
],
}
module.exports = [
// main process (runs in electron)
webpackMerge(nodeBaseConfig, COMMON_CONFIG, {
target: 'electron-main',
entry: { main: ENTRY_MAIN },
}),
// preload script (runs in the browser window)
webpackMerge(nodeBaseConfig, COMMON_CONFIG, {
target: 'electron-preload',
entry: { preload: ENTRY_PRELOAD },
}),
]