-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
webpack.config.main.js
48 lines (46 loc) · 1.12 KB
/
webpack.config.main.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
const path = require('path');
const webpack = require('webpack');
const CopyPlugin = require("copy-webpack-plugin");
const mode = process.env.NODE_ENV || "development";
const staticPath =
mode === "production" ?
"`${path.join(process.resourcesPath, 'static')}`" :
"'static'";
module.exports = {
mode,
target: 'electron-main',
devtool: 'cheap-module-source-map',
entry: './src/main/index.ts',
output: {
globalObject: 'this',
filename: 'index.js',
path: path.resolve(__dirname, 'build'),
publicPath: '',
clean: true
},
optimization: {
minimize: false,
},
module: {
rules: [
{
test: /\.(m|j|t)s$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader'
}
}
]
},
plugins: [
new webpack.ContextReplacementPlugin(/knex|express/),
new webpack.DefinePlugin({ '__static': staticPath }),
new CopyPlugin({
patterns: [ { from: "static/icons", to: "appx/" } ],
}),
],
resolve: {
extensions: ['.ts', '.js']
},
externals: { knex: 'commonjs knex', "browser-sync": 'commonjs browser-sync' }
};