Skip to content

Commit fb54ff6

Browse files
committed
Use isWebpack
1 parent 7382333 commit fb54ff6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/master/implementation.node.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ let tsNodeAvailable: boolean | undefined
3232
export const defaultPoolSize = cpus().length
3333

3434
function detectTsNode() {
35-
if (typeof __non_webpack_require__ === "function") {
35+
if (isWebpack) {
3636
// Webpack build: => No ts-node required or possible
3737
return false
3838
}
@@ -86,7 +86,8 @@ function resolveScriptPath(scriptPath: string, baseURL?: string | undefined) {
8686
return path.isAbsolute(filePath) ? filePath : path.join(baseURL || eval("__dirname"), filePath)
8787
}
8888

89-
const workerFilePath = typeof __non_webpack_require__ === "function"
89+
// Webpack hack
90+
const workerFilePath = isWebpack
9091
? __non_webpack_require__.resolve(makeRelative(scriptPath))
9192
: eval("require").resolve(makeRelative(rebaseScriptPath(scriptPath, /[\/\\]worker_threads[\/\\]/)))
9293

0 commit comments

Comments
 (0)