diff options
author | Chocobozzz <me@florianbigard.com> | 2019-10-21 17:13:07 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-10-21 17:13:22 +0200 |
commit | 2aaa1a3fdc49be77aec5309dab5507865c38d392 (patch) | |
tree | bc83c5b1ff49faf03461c78a110e0a5613343c31 /server/helpers | |
parent | 576ddf645ff2223126d28ef172bb6388602c35f4 (diff) | |
download | PeerTube-2aaa1a3fdc49be77aec5309dab5507865c38d392.tar.gz PeerTube-2aaa1a3fdc49be77aec5309dab5507865c38d392.tar.zst PeerTube-2aaa1a3fdc49be77aec5309dab5507865c38d392.zip |
Use typescript paths in cli scripts too
Diffstat (limited to 'server/helpers')
-rw-r--r-- | server/helpers/register-ts-paths.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/server/helpers/register-ts-paths.ts b/server/helpers/register-ts-paths.ts new file mode 100644 index 000000000..e8db369e3 --- /dev/null +++ b/server/helpers/register-ts-paths.ts | |||
@@ -0,0 +1,16 @@ | |||
1 | import { resolve } from 'path' | ||
2 | const tsConfigPaths = require('tsconfig-paths') | ||
3 | |||
4 | const tsConfig = require('../../tsconfig.json') | ||
5 | |||
6 | function registerTSPaths () { | ||
7 | // Thanks: https://github.com/dividab/tsconfig-paths/issues/75#issuecomment-458936883 | ||
8 | tsConfigPaths.register({ | ||
9 | baseUrl: resolve(tsConfig.compilerOptions.baseUrl || '', tsConfig.compilerOptions.outDir || ''), | ||
10 | paths: tsConfig.compilerOptions.paths | ||
11 | }) | ||
12 | } | ||
13 | |||
14 | export { | ||
15 | registerTSPaths | ||
16 | } | ||