Import module with alias for your Typescript app

Johan.Pujol
Digikare
Published in
1 min readOct 16, 2018

In this article we will see how to import your different modules in your Visual Studio Code or Webstorm for your Angular/React/Vuejs/NodeJs applications.

The nightmares of relative paths will be behind you

We will pass from this :

import { AuthModule } from ‘../../../../auth/auth-module’

To

import { AuthModule } from ‘@auth/auth-module’

As you can see we just import the alias @auth to point on the real folder.

Update your project

To do this, it’s very easy, you need to update your tsconfig.json file by adding paths property like this.

That it’s, i hope that help you.

--

--

Johan.Pujol
Digikare

Fullstack developer at Digikare. #NodeJS, #AngularJS, #Angular, #React #Vue #PHP #ionic