Skip to content

Commit 8c97e62

Browse files
committed
Merge pull request webpack#2181 from chentsulin/patch-1
make `electron-main` and `electron-renderer` targets works in 1.x
2 parents 3d5dc1a + f870006 commit 8c97e62

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

lib/WebpackOptionsApply.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
112112
break;
113113
case "atom":
114114
case "electron":
115+
case "electron-main":
115116
var NodeTemplatePlugin = require("./node/NodeTemplatePlugin");
116117
var NodeTargetPlugin = require("./node/NodeTargetPlugin");
117118
var ExternalsPlugin = require("./ExternalsPlugin");
@@ -144,6 +145,37 @@ WebpackOptionsApply.prototype.process = function(options, compiler) {
144145
new LoaderTargetPlugin(options.target)
145146
);
146147
break;
148+
case "electron-renderer":
149+
var JsonpTemplatePlugin = require("./JsonpTemplatePlugin");
150+
var NodeTargetPlugin = require("./node/NodeTargetPlugin");
151+
var ExternalsPlugin = require("./ExternalsPlugin");
152+
compiler.apply(
153+
new JsonpTemplatePlugin(options.output),
154+
new FunctionModulePlugin(options.output),
155+
new NodeTargetPlugin(),
156+
new ExternalsPlugin("commonjs", [
157+
"app",
158+
"auto-updater",
159+
"browser-window",
160+
"content-tracing",
161+
"dialog",
162+
"global-shortcut",
163+
"ipc",
164+
"menu",
165+
"menu-item",
166+
"power-monitor",
167+
"protocol",
168+
"tray",
169+
"remote",
170+
"web-view",
171+
"clipboard",
172+
"crash-reporter",
173+
"screen",
174+
"shell"
175+
]),
176+
new LoaderTargetPlugin(options.target)
177+
);
178+
break;
147179
default:
148180
throw new Error("Unsupported target '" + options.target + "'.");
149181
}

0 commit comments

Comments
 (0)