mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Add comments for esm vs cjs __dirname implementation
This commit is contained in:
parent
b366466e11
commit
aa441e7483
3 changed files with 15 additions and 3 deletions
|
|
@ -9,8 +9,12 @@ import { includePython } from "../config/cliArguments.js";
|
|||
import { fileURLToPath } from "url";
|
||||
|
||||
/** @type {string} */
|
||||
// This checks the current file's dirname in a way that's compatible with:
|
||||
// - Modulejs (import.meta.url)
|
||||
// - ES modules (__dirname)
|
||||
// This is needed because safe-chain's npm package is built using ES modules,
|
||||
// but building the binaries requires commonjs.
|
||||
let dirname;
|
||||
|
||||
if (import.meta.url) {
|
||||
const filename = fileURLToPath(import.meta.url);
|
||||
dirname = path.dirname(filename);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue