forked from lensapp/lens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.main.ts
executable file
·54 lines (52 loc) · 1.33 KB
/
webpack.main.ts
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
import path from "path";
import webpack from "webpack";
import ForkTsCheckerPlugin from "fork-ts-checker-webpack-plugin";
import { isDevelopment, isProduction, mainDir, buildDir } from "./src/common/vars";
import nodeExternals from "webpack-node-externals";
import ProgressBarPlugin from "progress-bar-webpack-plugin";
import * as vars from "./src/common/vars";
export default function (): webpack.Configuration {
console.info("WEBPACK:main", vars);
return {
context: __dirname,
target: "electron-main",
mode: isProduction ? "production" : "development",
devtool: isProduction ? "source-map" : "cheap-eval-source-map",
cache: isDevelopment,
entry: {
main: path.resolve(mainDir, "index.ts"),
},
output: {
libraryTarget: "global",
path: buildDir,
},
resolve: {
extensions: [".json", ".js", ".ts"]
},
externals: [
nodeExternals()
],
module: {
rules: [
{
test: /\.node$/,
use: "node-loader"
},
{
test: /\.ts$/,
exclude: /node_modules/,
use: {
loader: "ts-loader",
options: {
transpileOnly: true,
}
}
},
]
},
plugins: [
new ProgressBarPlugin(),
new ForkTsCheckerPlugin(),
].filter(Boolean)
};
}