N
N
Nikita Kudrin2021-11-14 14:28:00
typescript
Nikita Kudrin, 2021-11-14 14:28:00

child_process import disappear?

In index.ts I write import cp from "child_process";, I write tsc, in index.js this is no longer there (target & module = esnext)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-11-14
@HepkaPlay

Everything, of course, works.
Here is the minimal config for you:
package.json:

{
  "name": "ts",
  "version": "1.0.0",
  "type": "module",
  "main": "index.js",
  "module": "index.js",
  "license": "MIT",
  "dependencies": {
    "typescript": "^4.4.4"
  },
  "devDependencies": {
    "@types/node": "^16.11.7"
  }
}

tsconfig.json:
{
  "compilerOptions": {
    "target": "esnext",
    "module": "esnext",
    "esModuleInterop": true,
    "strict": true
  }
}

index.ts & resulting index.js:
import cp from "child_process";
console.log(cp);

Look for differences.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question