fix: support nodejs below v20.11 for `generate_buildonly.js` (#7214)

This commit is contained in:
Yat Ho 2024-11-01 11:15:05 +08:00 committed by GitHub
parent 2c82f3d83d
commit 361b5c6152
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -1,7 +1,9 @@
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; 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( const obj = JSON.parse(
fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'), fs.readFileSync(path.join(__dirname, 'package.json'), 'utf8'),
); );