aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/helpers/register-ts-paths.ts
blob: eec7fed3ef10ec844827dbf6affe09e38a5c2929 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
                              
                                                













                                                                                                    
import { resolve } from 'path'
import tsConfigPaths = require('tsconfig-paths')

const tsConfig = require('../../tsconfig.json')

function registerTSPaths () {
  // Thanks: https://github.com/dividab/tsconfig-paths/issues/75#issuecomment-458936883
  tsConfigPaths.register({
    baseUrl: resolve(tsConfig.compilerOptions.baseUrl || '', tsConfig.compilerOptions.outDir || ''),
    paths: tsConfig.compilerOptions.paths
  })
}

export {
  registerTSPaths
}