Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
fix: Target electron must include events polyfill (#1038)
Browse files Browse the repository at this point in the history
  • Loading branch information
nchanged committed Jan 17, 2018
1 parent e299205 commit 83f0058
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
35 changes: 32 additions & 3 deletions src/core/ServerPolyfillList.ts
@@ -1,4 +1,4 @@
const LIST = new Set<string>(
const SERVER_POLYFILL = new Set<string>(
[
"assert",
"buffer",
Expand All @@ -23,6 +23,35 @@ const LIST = new Set<string>(
"zlib"
]
);
export function isPolyfilledByFuseBox(name: string) {
return LIST.has(name);

const ELECTRON_POLYFILL = new Set<string>(
[
"assert",
"buffer",
"child_process",
"crypto",
"fs",
"http",
"https",
"module",
"net",
"os",
"path",
"process",
"querystring",
"stream",
"timers",
"tls",
"tty",
"url",
"util",
"zlib"
]
);
export function isServerPolyfill(name: string) {
return SERVER_POLYFILL.has(name);
}

export function isElectronPolyfill(name: string) {
return ELECTRON_POLYFILL.has(name);
}
10 changes: 7 additions & 3 deletions src/core/WorkflowContext.ts
Expand Up @@ -18,7 +18,7 @@ import { FuseBox } from "./FuseBox";
import { Bundle } from "./Bundle";
import { BundleProducer } from "./BundleProducer";
import { QuantumSplitConfig, QuantumSplitResolveConfiguration } from "../quantum/plugin/QuantumSplit";
import { isPolyfilledByFuseBox } from "./ServerPolyfillList";
import { isServerPolyfill, isElectronPolyfill } from "./ServerPolyfillList";
import { CSSDependencyExtractor, ICSSDependencyExtractorOptions } from "../lib/CSSDependencyExtractor";
import { ExtensionOverrides } from "./ExtensionOverrides";
import { TypescriptConfig } from "./TypescriptConfig";
Expand Down Expand Up @@ -552,8 +552,12 @@ export class WorkFlowContext {
if (this.ignoreGlobal.indexOf(name) > -1) {
return true;
}
if (this.target === "server" || this.target === "electron") {
return isPolyfilledByFuseBox(name)
if (this.target === "server") {
return isServerPolyfill(name)
}

if (this.target === "electron") {
return isElectronPolyfill(name)
}
}

Expand Down

0 comments on commit 83f0058

Please sign in to comment.