Add support for ES module path resolution in convert.js

This commit is contained in:
Eli Kogan-Wang 2025-03-20 17:12:02 +01:00
parent aebb1ae26a
commit 1dc4cdf4af
1 changed files with 3 additions and 0 deletions

View File

@ -5,12 +5,15 @@ import { program } from 'commander';
import fs from 'fs'; import fs from 'fs';
import fse from 'fs-extra'; import fse from 'fs-extra';
import babel from '@babel/core'; import babel from '@babel/core';
import { fileURLToPath } from 'url';
program program
.option('-m, --with-source-maps [type]', 'output source maps when not generating a bundled app (type may be empty for external source maps, inline for inline source maps, or both) ') .option('-m, --with-source-maps [type]', 'output source maps when not generating a bundled app (type may be empty for external source maps, inline for inline source maps, or both) ')
.option('--clean', 'clear the lib folder before building') .option('--clean', 'clear the lib folder before building')
.parse(process.argv); .parse(process.argv);
const __dirname = path.dirname(fileURLToPath(import.meta.url));
// the various important paths // the various important paths
const paths = { const paths = {
main: path.resolve(__dirname, '..'), main: path.resolve(__dirname, '..'),