LoginSignup
3
0

More than 3 years have passed since last update.

ts-node-devで起動されたかを調べる方法

Posted at

プロセスがts-node-devで起動されたかを調べる方法です。

const isTsNodeDev = Object.keys(require.cache).some(path => /\/ts-node-dev\//.test(path))

ts-node-devで起動すると、nodeの-rオプションにts-node-devが渡されるため、ロード済みのモジュールに'ts-node-dev'の文字列があるかを調べれば良いわけです。

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0