at master 51 lines 1.7 kB view raw
1From e881a383b38d4d80ee28c17a14b5de58889245de Mon Sep 17 00:00:00 2001 2From: Alexandre Iooss <erdnaxe@crans.org> 3Date: Tue, 5 Nov 2024 16:30:33 +0100 4Subject: [PATCH] Use temporary directory for esbuild 5 6--- 7 src/node/hooks/express/specialpages.ts | 11 +++++------ 8 9diff --git a/src/node/hooks/express/specialpages.ts b/src/node/hooks/express/specialpages.ts 10index 2e26eaa0cee..31d5138e67c 100644 11--- a/src/node/hooks/express/specialpages.ts 12+++ b/src/node/hooks/express/specialpages.ts 13@@ -3,6 +3,7 @@ 14 import path from 'node:path'; 15 const eejs = require('../../eejs') 16 import fs from 'node:fs'; 17+import os from 'node:os'; 18 const fsp = fs.promises; 19 const toolbar = require('../../utils/toolbar'); 20 const hooks = require('../../../static/js/pluginfw/hooks'); 21@@ -89,7 +90,7 @@ const convertTypescript = (content: string) => { 22 const outputRaw = buildSync({ 23 stdin: { 24 contents: content, 25- resolveDir: path.join(settings.root, 'var','js'), 26+ resolveDir: settings.root, 27 loader: 'js' 28 }, 29 alias:{ 30@@ -222,7 +223,7 @@ const convertTypescriptWatched = (content: string, cb: (output:string, hash: str 31 build({ 32 stdin: { 33 contents: content, 34- resolveDir: path.join(settings.root, 'var','js'), 35+ resolveDir: settings.root, 36 loader: 'js' 37 }, 38 alias:{ 39@@ -276,10 +277,8 @@ exports.expressCreateServer = async (hookName: string, args: ArgsExpressType, cb 40 settings, 41 }) 42 43- 44- 45- const outdir = path.join(settings.root, 'var','js') 46- // Create the outdir if it doesn't exist 47+ // Create a temporary directory to store runtime-built JS files 48+ const outdir = path.join(os.tmpdir(), 'js'); 49 if (!fs.existsSync(outdir)) { 50 fs.mkdirSync(outdir); 51 }