File tree 1 file changed +6
-22
lines changed
1 file changed +6
-22
lines changed Original file line number Diff line number Diff line change 1
- // Webpack hack
2
- // tslint:disable no-eval
3
-
4
- declare function __non_webpack_require__ ( module : string ) : any
5
-
6
- // FIXME
7
- type MessagePort = any
8
-
9
- interface WorkerThreadsModule {
10
- MessagePort : typeof MessagePort
11
- isMainThread : boolean
12
- parentPort : MessagePort
13
- }
14
-
15
- let implementation : WorkerThreadsModule | undefined
1
+ // TODO this file isn't used!
16
2
17
- function selectImplementation ( ) : WorkerThreadsModule {
18
- return typeof __non_webpack_require__ === "function"
19
- ? __non_webpack_require__ ( "worker_threads" )
20
- : eval ( "require" ) ( "worker_threads" )
21
- }
3
+ // Webpack hack
4
+ import { requireFunction } from './webpack-hack'
22
5
23
- export default function getImplementation ( ) : WorkerThreadsModule {
6
+ let implementation : typeof import ( "worker_threads" ) | undefined
7
+ export default function getImplementation ( ) {
24
8
if ( ! implementation ) {
25
- implementation = selectImplementation ( )
9
+ implementation = ( requireFunction ( "worker_threads" ) as typeof import ( "worker_threads" ) )
26
10
}
27
11
return implementation
28
12
}
You can’t perform that action at this time.
0 commit comments