Skip to content

Commit 5a3460e

Browse files
authored
Worker instantiation won't throw immediately, so use ASAR fallback straight away (#236)
1 parent 07c4d3a commit 5a3460e

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/master/implementation.node.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,8 @@ function initWorkerThreadsWorker(): typeof WorkerImplementation {
9292
if (resolvedScriptPath.match(/\.tsx?$/i) && detectTsNode()) {
9393
super(createTsNodeModule(resolvedScriptPath), { ...options, eval: true })
9494
} else if (resolvedScriptPath.match(/\.asar[\/\\]/)) {
95-
try {
96-
super(resolvedScriptPath, options)
97-
} catch {
98-
// See <https://github.com/andywer/threads-plugin/issues/17>
99-
super(resolvedScriptPath.replace(/\.asar([\/\\])/, ".asar.unpacked$1"), options)
100-
}
95+
// See <https://github.com/andywer/threads-plugin/issues/17>
96+
super(resolvedScriptPath.replace(/\.asar([\/\\])/, ".asar.unpacked$1"), options)
10197
} else {
10298
super(resolvedScriptPath, options)
10399
}
@@ -154,12 +150,8 @@ function initTinyWorker(): typeof WorkerImplementation {
154150
if (resolvedScriptPath.match(/\.tsx?$/i) && detectTsNode()) {
155151
super(new Function(createTsNodeModule(resolveScriptPath(scriptPath))), [], { esm: true })
156152
} else if (resolvedScriptPath.match(/\.asar[\/\\]/)) {
157-
try {
158-
super(resolvedScriptPath, [], { esm: true })
159-
} catch {
160-
// See <https://github.com/andywer/threads-plugin/issues/17>
161-
super(resolvedScriptPath.replace(/\.asar([\/\\])/, ".asar.unpacked$1"), [], { esm: true })
162-
}
153+
// See <https://github.com/andywer/threads-plugin/issues/17>
154+
super(resolvedScriptPath.replace(/\.asar([\/\\])/, ".asar.unpacked$1"), [], { esm: true })
163155
} else {
164156
super(resolvedScriptPath, [], { esm: true })
165157
}

0 commit comments

Comments
 (0)