mirror of https://github.com/webpack/webpack.git
72 lines
1.3 KiB
JavaScript
72 lines
1.3 KiB
JavaScript
|
/*
|
||
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
||
|
Author Tobias Koppers @sokra
|
||
|
*/
|
||
|
|
||
|
"use strict";
|
||
|
|
||
|
const ExternalsPlugin = require("../ExternalsPlugin");
|
||
|
|
||
|
/** @typedef {import("../Compiler")} Compiler */
|
||
|
|
||
|
class ElectronTargetPlugin {
|
||
|
/**
|
||
|
* @param {boolean} main in main scope?
|
||
|
*/
|
||
|
constructor(main) {
|
||
|
this._main = main;
|
||
|
}
|
||
|
/**
|
||
|
* Apply the plugin
|
||
|
* @param {Compiler} compiler the compiler instance
|
||
|
* @returns {void}
|
||
|
*/
|
||
|
apply(compiler) {
|
||
|
new ExternalsPlugin(
|
||
|
"commonjs",
|
||
|
this._main
|
||
|
? [
|
||
|
"app",
|
||
|
"auto-updater",
|
||
|
"browser-window",
|
||
|
"clipboard",
|
||
|
"content-tracing",
|
||
|
"crash-reporter",
|
||
|
"dialog",
|
||
|
"electron",
|
||
|
"global-shortcut",
|
||
|
"ipc",
|
||
|
"ipc-main",
|
||
|
"menu",
|
||
|
"menu-item",
|
||
|
"native-image",
|
||
|
"original-fs",
|
||
|
"power-monitor",
|
||
|
"power-save-blocker",
|
||
|
"protocol",
|
||
|
"screen",
|
||
|
"session",
|
||
|
"shell",
|
||
|
"tray",
|
||
|
"web-contents"
|
||
|
]
|
||
|
: [
|
||
|
"clipboard",
|
||
|
"crash-reporter",
|
||
|
"desktop-capturer",
|
||
|
"electron",
|
||
|
"ipc",
|
||
|
"ipc-renderer",
|
||
|
"native-image",
|
||
|
"original-fs",
|
||
|
"remote",
|
||
|
"screen",
|
||
|
"shell",
|
||
|
"web-frame"
|
||
|
]
|
||
|
).apply(compiler);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = ElectronTargetPlugin;
|