diff --git a/src/master/implementation.node.ts b/src/master/implementation.node.ts index bf5a6ddb..6de7ae5f 100644 --- a/src/master/implementation.node.ts +++ b/src/master/implementation.node.ts @@ -115,8 +115,13 @@ function initWorkerThreadsWorker(): ImplementationExport { } else if (resolvedScriptPath.match(/\.tsx?$/i) && detectTsNode()) { super(createTsNodeModule(resolvedScriptPath), { ...options, eval: true }) } else if (resolvedScriptPath.match(/\.asar[\/\\]/)) { - // See - super(resolvedScriptPath.replace(/\.asar([\/\\])/, ".asar.unpacked$1"), options) + const electronPath = + options?.electronAsarUnpacked === false + ? resolvedScriptPath + // See + : resolvedScriptPath.replace(/\.asar([\/\\])/, ".asar.unpacked$1") + + super(electronPath, options) } else { super(resolvedScriptPath, options) } diff --git a/src/types/master.ts b/src/types/master.ts index 604e7fa9..bbf8fa80 100644 --- a/src/types/master.ts +++ b/src/types/master.ts @@ -94,6 +94,10 @@ export interface ThreadsWorkerOptions extends WorkerOptions { /** Data passed on to node.js worker_threads. */ workerData?: any + /** If Electron workers should use the asar.unpacked path. Default to true. + * See */ + electronAsarUnpacked?: boolean + /** Whether to apply CORS protection workaround. Defaults to true. */ CORSWorkaround?: boolean }