From 361b5c6152bf8d90d7dbc6937df133d458dda6b4 Mon Sep 17 00:00:00 2001 From: Yat Ho Date: Fri, 1 Nov 2024 11:15:05 +0800 Subject: [PATCH] fix: support nodejs below v20.11 for `generate_buildonly.js` (#7214) --- web/generate-buildonly.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/web/generate-buildonly.js b/web/generate-buildonly.js index 4ce7ddc4f..4079fe1c2 100644 --- a/web/generate-buildonly.js +++ b/web/generate-buildonly.js @@ -1,7 +1,9 @@ import fs from 'node:fs'; import path from 'node:path'; +import url from 'node:url'; -const __dirname = import.meta.dirname; +const __filename = url.fileURLToPath(import.meta.url); +const __dirname = path.dirname(__filename); const obj = JSON.parse( fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'), );