-
Notifications
You must be signed in to change notification settings - Fork 99
Expand file tree
/
Copy pathwebpack.main.mjs
More file actions
77 lines (72 loc) · 1.58 KB
/
Copy pathwebpack.main.mjs
File metadata and controls
77 lines (72 loc) · 1.58 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import path from "node:path";
import { fileURLToPath } from "node:url";
import { dirname } from "node:path";
import { merge } from "webpack-merge";
import CopyWebpackPlugin from "copy-webpack-plugin";
import nodeExternals from "webpack-node-externals";
import TsconfigPathsPlugin from "tsconfig-paths-webpack-plugin";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const common = {
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules\/(?!(@bitwarden)\/).*/,
},
],
},
plugins: [],
resolve: {
extensions: [".tsx", ".ts", ".js"],
plugins: [new TsconfigPathsPlugin({ configFile: "./tsconfig.json" })],
},
experiments: {
outputModule: true,
},
output: {
filename: "[name].js",
path: path.resolve(__dirname, "build"),
clean: true,
library: {
type: "module",
},
chunkFormat: "module",
},
};
const main = {
mode: "production",
target: "electron-main",
node: {
__dirname: "node-module",
__filename: "node-module",
},
entry: {
main: "./src-gui/main.ts",
},
optimization: {
minimize: false,
},
module: {
rules: [
{
test: /\.node$/,
loader: "node-loader",
},
],
},
plugins: [
new CopyWebpackPlugin({
patterns: [
"./package.json",
{ from: "./src-gui/images", to: "images" },
{ from: "./src-gui/locales", to: "locales" },
],
}),
],
externals: {
"dc-native": "module dc-native",
},
};
export default merge(common, main);