register-ts-paths.ts 455 B

12345678910111213141516
  1. import { resolve } from 'path'
  2. import tsConfigPaths = require('tsconfig-paths')
  3. const tsConfig = require('../../tsconfig.json')
  4. function registerTSPaths () {
  5. // Thanks: https://github.com/dividab/tsconfig-paths/issues/75#issuecomment-458936883
  6. tsConfigPaths.register({
  7. baseUrl: resolve(tsConfig.compilerOptions.baseUrl || '', tsConfig.compilerOptions.outDir || ''),
  8. paths: tsConfig.compilerOptions.paths
  9. })
  10. }
  11. export {
  12. registerTSPaths
  13. }