-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathwebpack.base.config.js
47 lines (40 loc) · 1.26 KB
/
webpack.base.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
37
38
39
40
41
42
43
44
45
46
47
// It is possible for the webpack configuration to be written in TypeScript, but this will not work
// with the full range of options in "tsconfig.json". Keep the config file written in JavaScript for
// simplicity.
const path = require("node:path");
function getBaseConfig(electronType) {
return {
mode: "development",
entry: path.join(__dirname, "src", electronType, "main.ts"),
target: `electron-${electronType}`,
module: {
rules: [
{
test: /\.ts$/,
include: [
path.join(__dirname, "src", electronType),
path.join(__dirname, "src", "common"),
],
use: [{ loader: "ts-loader" }],
},
{
test: /\.node$/,
loader: "node-loader",
},
],
},
output: {
path: path.join(__dirname, "dist", electronType),
filename: "main.js",
},
// - .js is needed for libraries (Electron itself, etc.).
// - .json is needed to import JSON files in the "data" directory.
resolve: {
extensions: [".js", ".ts", ".json"],
},
// Enable source maps for debugging purposes. (This will show the line number of the real file
// in the browser console.)
devtool: "source-map",
};
}
module.exports = getBaseConfig;