Use createRequire with createRequireFromPath as fallback
MODIFY
package.json
package.json
"dependencies": {},
"///": "Only used for static type checking",
"devDependencies": {
- "@types/node": "^12.0.8",
+ "@types/node": "^13.7.7",
"@types/react": "^16.8.23",
"@types/react-dom": "^16.8.5",
"typescript": "^3.7.0",

MODIFY
packages/@romejs/core/common/utils/executeMain.ts
packages/@romejs/core/common/utils/executeMain.ts
@@ -51,7 +51,9 @@ export default async function executeMain(
setImmediate,
setInterval,
setTimeout,
- require: internalModule.createRequireFromPath(filename),
+ require:
+ internalModule.createRequire(filename) ||
+ internalModule.createRequireFromPath(filename),
console,
__dirname: path.getParent().join(),
__filename: filename,

MODIFY
packages/@romejs/node/index.ts
packages/@romejs/node/index.ts
@@ -18,7 +18,9 @@ function getRequire(folder: AbsoluteFilePath = CWD_PATH): RequireFunction {
return cached;
}
- const req = mod.createRequireFromPath(folder.join());
+ const filename = folder.join();
+ const req =
+ mod.createRequire(filename) || mod.createRequireFromPath(filename);
requires.set(folder, req);
return req;
}

Use createRequire with createRequireFromPath as fallback