I found typescript version for node unfortunately it's not able find "child_process" module from the node packages.
Exactly the error message in my console is Module not found: Error: Can't resolve 'child_process'
When I went through some blog they recommended to add below code in your tsconfig.json file.
"typeRoots": [
"node_modules/@types"
]
Same thing as I pasted over here unlikely it's did't help.
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
}
}
Why they don't inject this node module ? Am I doing something wrong in tsconfig.json file? I would be a grateful if you could give a little help. Thanks in advance.
Maybe is the path:
"typeRoots": [
"../node_modules/@types"
]
Usually you have your tsconfig in a src
.
Update:
My original answer makes no sense, because you have this "baseUrl": "src"
.
As instead, I believe it could be a Webpack issue.
Try adding this to your webpack.config file:
target: 'node'
Update 2:
Workaround: Add the following to your config file:
node: {
child_process: 'empty'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With