MCPcopy Index your code
hub / github.com/electron/forge / WebpackPlugin

Class WebpackPlugin

packages/plugin/webpack/src/WebpackPlugin.ts:43–792  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41};
42
43export default class WebpackPlugin extends PluginBase<WebpackPluginConfig> {
44 name = 'webpack';
45
46 private isProd = false;
47
48 // The root of the Electron app
49 private projectDir!: string;
50
51 // Where the Webpack output is generated. Usually `$projectDir/.webpack`
52 private baseDir!: string;
53
54 private _configGenerator!: WebpackConfigGenerator;
55
56 private watchers: Watching[] = [];
57
58 private servers: http.Server[] = [];
59
60 private loggers: Logger[] = [];
61
62 private port = DEFAULT_PORT;
63
64 private loggerPort = DEFAULT_LOGGER_PORT;
65
66 constructor(c: WebpackPluginConfig) {
67 super(c);
68
69 if (c.port) {
70 if (this.isValidPort(c.port)) {
71 this.port = c.port;
72 }
73 }
74 if (c.loggerPort) {
75 if (this.isValidPort(c.loggerPort)) {
76 this.loggerPort = c.loggerPort;
77 }
78 }
79
80 this.getHooks = this.getHooks.bind(this);
81 }
82
83 private isValidPort = (port: number) => {
84 if (port < 1024) {
85 throw new Error(
86 `Cannot specify port (${port}) below 1024, as they are privileged`,
87 );
88 } else if (port > 65535) {
89 throw new Error(`Port specified (${port}) is not a valid TCP port.`);
90 } else {
91 return true;
92 }
93 };
94
95 exitHandler = (
96 options: { cleanup?: boolean; exit?: boolean },
97 err?: Error,
98 ): void => {
99 d('handling process exit with:', options);
100 if (options.cleanup) {

Callers

nothing calls this directly

Calls 8

writeJSONStatsMethod · 0.95
devServerOptionsMethod · 0.95
stopMethod · 0.80
setDirectoriesMethod · 0.80
createTabMethod · 0.80
getMainConfigMethod · 0.80
getRendererConfigMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected