source: frontend/node_modules/webpack/lib/electron/ElectronTargetPlugin.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.5 KB
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3 Author Tobias Koppers @sokra
4*/
5
6"use strict";
7
8const ExternalsPlugin = require("../ExternalsPlugin");
9
10/** @typedef {import("../Compiler")} Compiler */
11/** @typedef {"main" | "preload" | "renderer"} ElectronContext */
12
13class ElectronTargetPlugin {
14 /**
15 * Creates an instance of ElectronTargetPlugin.
16 * @param {ElectronContext=} context in main, preload or renderer context?
17 */
18 constructor(context) {
19 /** @type {ElectronContext | undefined} */
20 this._context = context;
21 }
22
23 /**
24 * Applies the plugin by registering its hooks on the compiler.
25 * @param {Compiler} compiler the compiler instance
26 * @returns {void}
27 */
28 apply(compiler) {
29 new ExternalsPlugin("node-commonjs", [
30 "clipboard",
31 "crash-reporter",
32 "electron",
33 "ipc",
34 "native-image",
35 "original-fs",
36 "screen",
37 "shell"
38 ]).apply(compiler);
39 switch (this._context) {
40 case "main":
41 new ExternalsPlugin("node-commonjs", [
42 "app",
43 "auto-updater",
44 "browser-window",
45 "content-tracing",
46 "dialog",
47 "global-shortcut",
48 "ipc-main",
49 "menu",
50 "menu-item",
51 "power-monitor",
52 "power-save-blocker",
53 "protocol",
54 "session",
55 "tray",
56 "web-contents"
57 ]).apply(compiler);
58 break;
59 case "preload":
60 case "renderer":
61 new ExternalsPlugin("node-commonjs", [
62 "desktop-capturer",
63 "ipc-renderer",
64 "remote",
65 "web-frame"
66 ]).apply(compiler);
67 break;
68 }
69 }
70}
71
72module.exports = ElectronTargetPlugin;
Note: See TracBrowser for help on using the repository browser.