From e717c51aa1e46d1a1aabdb7e770c248b93e437a6 Mon Sep 17 00:00:00 2001 From: Billy Biggs Date: Sat, 14 Jun 2025 22:30:00 -0700 Subject: Avoid import.meta.dirname to be backwards compatible to Node.js 18+ (#1058) --- scripts/build.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts/build.js') diff --git a/scripts/build.js b/scripts/build.js index 373e268e..f43a0645 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -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'))) { -- cgit v1.2.3