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