Avoid import.meta.dirname to be backwards compatible to Node.js 18+ (#1058)

This commit is contained in:
Billy Biggs
2025-06-14 22:30:00 -07:00
committed by GitHub
parent 53753f0455
commit e717c51aa1
5 changed files with 20 additions and 10 deletions

View File

@@ -20,9 +20,11 @@
import { execSync } from 'child_process';
import { existsSync } from 'fs';
import { join } from 'path';
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
const root = join(import.meta.dirname, '..');
const __dirname = dirname(fileURLToPath(import.meta.url));
const root = join(__dirname, '..');
// npm install if node_modules was removed (e.g. via npm run clean or scripts/clean.js)
if (!existsSync(join(root, 'node_modules'))) {