Skip to content

Commit c685aec

Browse files
committed
Move webpack hack to a separate file
1 parent 0cf99be commit c685aec

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

Diff for: src/master/implementation.node.ts

+1-5
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,14 @@ import {
1010
ThreadsWorkerOptions,
1111
WorkerImplementation
1212
} from "../types/master"
13+
import { isWebpack, requireFunction, __non_webpack_require__ } from '../webpack-hack'
1314

1415
interface WorkerGlobalScope {
1516
addEventListener(eventName: string, listener: (event: Event) => void): void
1617
postMessage(message: any, transferables?: any[]): void
1718
removeEventListener(eventName: string, listener: (event: Event) => void): void
1819
}
1920

20-
// TODO remove webpack hacks. These hurt the performance for non-web-pack situations
21-
// Webpack hack
22-
declare let __non_webpack_require__: typeof require
23-
const isWebpack = typeof __non_webpack_require__ === "function"
24-
const requireFunction: typeof require = isWebpack ? __non_webpack_require__ : eval("require")
2521

2622
declare const self: WorkerGlobalScope
2723

Diff for: src/webpack-hack.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// tslint:disable no-eval
2+
3+
// TODO remove webpack hacks. These hurt the performance for non-web-pack situations
4+
// Webpack hack
5+
export declare let __non_webpack_require__: typeof require
6+
export const isWebpack = typeof __non_webpack_require__ === "function"
7+
export const requireFunction: typeof require = isWebpack ? __non_webpack_require__ : eval("require")

0 commit comments

Comments
 (0)