ESMLoader with Node/ts-node launched via VS Code #1743
JCropsey-Clearwave
started this conversation in
General
Replies: 1 comment
-
We request additional information in our bug report template that has been omitted here. I'll convert this to a discussion so the community can solicit the additional information. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I try to run Node with ts-node via VS Code, I get the following error despite its having worked previously with the same configuration:
TypeError: Invalid module "file:///C:/Projects/CW-Port0/infra/azure/src/create-resources.ts"
at new NodeError (node:internal/errors:371:5)
at ESMLoader.load (node:internal/modules/esm/loader:380:13)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:280:47)
at link (node:internal/modules/esm/module_job:70:21)
create-resources.ts is the main file for the project.
Possibly related to #1636.
launch.json:
{ "version": "0.2.0", "configurations": [ { "type": "node", "request": "launch", "name": "Launch Program", "runtimeArgs": [ //"-r", "ts-node/register", "--experimental-specifier-resolution=node", "--loader", "ts-node/esm" ], "args": [ "${workspaceFolder}/src/create-resources.ts", "--" ], "debug.javascript.terminalOptions": { "skipFiles": [ "<node_internals>/**" ] }, } ] }
tsconfig.json:
{ "compilerOptions": { "module": "esnext", "target": "es2018", "moduleResolution": "node", "esModuleInterop": true, "noEmit": true, "noImplicitAny": true, "outDir": "dist", "removeComments": false, "preserveConstEnums": true, "sourceMap": true, "lib":[ "DOM" ], // "dom.iterable" "types": [ "node", ] }, "ts-node": { "skipIgnore": false }, "include": [ "./src/*" ], "exclude": [ "node_modules", "./*.spec.ts", "./src/*.spec.ts" ] }
Beta Was this translation helpful? Give feedback.
All reactions