What is the runtime solution for importing TypeScript files? (Using type: "module"
, without access to environment variables/arguments)
#1561
Answered
by
cspotcode
brianjenkins94
asked this question in
Q&A
-
require("ts-node").register(/* ...tsconfig */)
require("hello.ts"); Used to work. I'm not finding a programmatic Is there one? Attempting to reason through how import { fileURLToPath } from 'url';
import { createRequire } from 'module';
const require = createRequire(fileURLToPath(import.meta.url));
const {
resolve,
load,
getFormat,
transformSource,
} from "ts-node/esm"; But |
Beta Was this translation helpful? Give feedback.
Answered by
cspotcode
Dec 5, 2021
Replies: 1 comment 1 reply
-
Node does not have any runtime API for this, so it's a node limitation. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
brianjenkins94
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Node does not have any runtime API for this, so it's a node limitation.