forked from TypeStrong/ts-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt workaround for node regression (TypeStrong#1838)
* attempt workaround for node regression * lint-fix * fix
- Loading branch information
Showing
2 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const {pathToFileURL} = require('url'); | ||
|
||
// Hack to avoid Module.runMain on node 18.6.0 | ||
// Keeping it simple for now, isolated in this file. | ||
// Could theoretically probe `getFormat` impl to determine if `import()` or `Module._load()` is best | ||
// Note that I attempted a try-catch around `Module._load`, but it poisons some sort of cache such that subsequent `import()` is impossible. | ||
exports.run = function(entryPointPath) { | ||
import(pathToFileURL(entryPointPath)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters