From 7aebdd15f6315b404d22a9dbbd1d0945367ec217 Mon Sep 17 00:00:00 2001 From: Paul Fitzpatrick Date: Mon, 28 Aug 2023 08:11:01 -0400 Subject: [PATCH] tweak XLSX export worker to make Piscina happy under Electon (#646) Adds a dummy default export to the worker exporter script used for producing XLSX. This method exists only to make Piscina happier. With it, Piscina will load this file using a regular require(), which under Electron will deal fine with Electron's ASAR app bundle. Without it, Piscina will try fancier methods that aren't at the time of writing correctly patched to deal with an ASAR app bundle, and so report that this file doesn't exist instead of exporting an XLSX file. I tried various other solutions such as upgrading Electron, unpacking various files, patching Piscina, and this was overall the simplest. See https://github.com/gristlabs/grist-electron/issues/9 --- app/server/lib/workerExporter.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/server/lib/workerExporter.ts b/app/server/lib/workerExporter.ts index 153fa1af..bb8f6c12 100644 --- a/app/server/lib/workerExporter.ts +++ b/app/server/lib/workerExporter.ts @@ -224,3 +224,14 @@ export function sanitizeWorksheetName(tableName: string): string { .replace(/^['\s]+/, '') .replace(/['\s]+$/, ''); } + +// This method exists only to make Piscina happier. With it, +// Piscina will load this file using a regular require(), +// which under Electron will deal fine with Electron's ASAR +// app bundle. Without it, Piscina will try fancier methods +// that aren't at the time of writing correctly patched to +// deal with an ASAR app bundle, and so report that this +// file doesn't exist instead of exporting an XLSX file. +// https://github.com/gristlabs/grist-electron/issues/9 +export default function doNothing() { +}