-
Notifications
You must be signed in to change notification settings - Fork 41
/
webpack.config.cjs
42 lines (39 loc) · 982 Bytes
/
webpack.config.cjs
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
const path = require('path')
const CircularDependencyPlugin = require('circular-dependency-plugin')
const webpack = require('webpack')
const nodeExternals = require('webpack-node-externals')
module.exports = function (env, options) {
return [getClientSide(options), getServerSide(options)]
}
function getClientSide (options) {
const config = {
target: 'web',
entry: './src/js/index.js',
output: {
filename: 'script.js',
path: path.resolve(__dirname, 'app/js')
},
plugins: [
new CircularDependencyPlugin(),
new webpack.ExternalsPlugin('commonjs', [
'electron'
])
]
}
return config
}
function getServerSide (options) {
const config = {
target: 'electron-main',
entry: './src/electron/index.js',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'app')
},
plugins: [
new CircularDependencyPlugin()
],
externals: [nodeExternals()]
}
return config
}