Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(target): support electron preload async chunk loading #9188

Merged
merged 1 commit into from May 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion declarations/WebpackOptions.d.ts
Expand Up @@ -390,7 +390,8 @@ export interface WebpackOptions {
| "async-node"
| "node-webkit"
| "electron-main"
| "electron-renderer")
| "electron-renderer"
| "electron-preload")
| ((compiler: import("../lib/Compiler")) => void);
/**
* Enter watch mode, which rebuilds on file change.
Expand Down
12 changes: 10 additions & 2 deletions lib/WebpackOptionsApply.js
Expand Up @@ -156,11 +156,19 @@ class WebpackOptionsApply extends OptionsApply {
new LoaderTargetPlugin(options.target).apply(compiler);
break;
case "electron-renderer":
JsonpTemplatePlugin = require("./web/JsonpTemplatePlugin");
case "electron-preload":
FetchCompileWasmTemplatePlugin = require("./web/FetchCompileWasmTemplatePlugin");
NodeTargetPlugin = require("./node/NodeTargetPlugin");
ExternalsPlugin = require("./ExternalsPlugin");
new JsonpTemplatePlugin().apply(compiler);
if (options.target === "electron-renderer") {
JsonpTemplatePlugin = require("./web/JsonpTemplatePlugin");
new JsonpTemplatePlugin().apply(compiler);
} else if (options.target === "electron-preload") {
NodeTemplatePlugin = require("./node/NodeTemplatePlugin");
new NodeTemplatePlugin({
asyncChunkLoading: true
}).apply(compiler);
}
new FetchCompileWasmTemplatePlugin({
mangleImports: options.optimization.mangleWasmImports
}).apply(compiler);
Expand Down
3 changes: 2 additions & 1 deletion schemas/WebpackOptions.json
Expand Up @@ -2128,7 +2128,8 @@
"async-node",
"node-webkit",
"electron-main",
"electron-renderer"
"electron-renderer",
"electron-preload"
]
},
{
Expand Down