Skip to content

Commit

Permalink
[WEBPACK] Avoid warning on certain webpack builds. Fixes #19
Browse files Browse the repository at this point in the history
  • Loading branch information
darionco committed May 1, 2020
1 parent 20ea4e6 commit 818b73e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/helper/node/WorkerClass.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
var kRequire =
typeof module !== 'undefined' && typeof module.require === 'function' && module.require || // eslint-disable-line
typeof __non_webpack_require__ === 'function' && __non_webpack_require__ || // eslint-disable-line
typeof require === 'function' && require || // eslint-disable-line
null; // eslint-disable-line

var WorkerClass = null;

if (kRequire) {
try { WorkerClass = kRequire('worker_threads').Worker; } catch(e) {} // eslint-disable-line
}
try {
var WorkerThreads =
typeof module !== 'undefined' && typeof module.require === 'function' && module.require('worker_threads') ||
typeof __non_webpack_require__ === 'function' && __non_webpack_require__('worker_threads') ||
typeof require === 'function' && require('worker_threads');
WorkerClass = WorkerThreads.Worker;
} catch(e) {} // eslint-disable-line

export {WorkerClass};

0 comments on commit 818b73e

Please sign in to comment.