Closed sringly closed 2 years ago
clinic doctor should run fine on any transpiled typescript project. To answer your question we'd need to know a bit more about how you have your application set up to run.
@llfylwg hi. try running the transpiler version of your code. First, you need to make a build so that the dist
folder appears.
Then you can run your code
clinic doctor --on-port 'autocannon localhost:$PORT' -- node _paste_entry_point_here_
In my case this is:
clinic doctor --on-port 'autocannon localhost:$PORT' -- node dist/src/main.js
I am adding this for anyone who stumbles upon this in the future. I added the following to out package.json scripts. Shows how to transpile and config dotenv with custom .env file while using clinic.js.
"clinic:heap": "tsc -p tsconfig.json && clinic heap -- node -r dotenv/config dist/index.js dotenv_config_path=dev1.env"
Additionally, if you are handling signals in your app, you will need something like:
// For development, we don't want to handle signals, so we can let clinic.js do its thing
if (process.env.NODE_ENV !== 'development') {
process.on('SIGINT', handleSignal)
process.on('SIGTERM', handleSignal)
}
Note: You may want to create a new NODE_ENV that is closer to production than development
might be. In our case, development
changes how our logging works but did not matter for the purposes of our clinic.js usage.
please has someone can tell me ?