# Tsconfig.json modifications not working

**URL:** <https://forum.ionicframework.com/t/tsconfig-json-modifications-not-working/72098>\
**Category:** ionic-v3\
**Created:** [December 2, 2016, 5:48pm UTC](https://forum.ionicframework.com/t/tsconfig-json-modifications-not-working/72098 "2016-12-02T17:48:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![NoelDeMartin](https://avatars.discourse-cdn.com/v4/letter/n/46a35a/32.png) [@NoelDeMartin](https://forum.ionicframework.com/u/NoelDeMartin)\
**Post date:** [December 2, 2016, 5:48pm UTC](https://forum.ionicframework.com/t/tsconfig-json-modifications-not-working/72098/1 "2016-12-02T17:48:02Z")

</div>

I started an ionic 2 project and one of the few things I don’t like is the relative paths. I read some documentation from typescript and I modified the tsconfig.json file, and seems like the modifications I do are not taking any effect in the ionic app (but are working in typescript).

I learned how typescript works from the documentation: [http://www.typescriptlang.org/docs/handbook/module-resolution.html](http://www.typescriptlang.org/docs/handbook/module-resolution.html)

I validated that my changes to tsconfig.json are correct since calling “tsc --traceResolution” tells me the resolution is working. But once I launch the ionic app I get the “Cannot find module” error.

**Example**

In case anyone is interested in reproducing the issue, create a brand new ionic 2 project, modify tsconfig.json by adding the following to compilerOptions:

```
"baseUrl": "./src",

```

Then create the file src/foo.ts with the contents:

```
export class Foo {}

```

finally add the following to app.module.ts:

```
import { Foo } from 'foo';
new Foo();

```

As far as I understand that should work, it doesn’t and for it to work it is necessary to have the following (which I want to avoid):

```
import { Foo } from '../foo';
new Foo();
```

---

<div class="post-metadata">

**Author:** ![drobec](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@drobec](https://forum.ionicframework.com/u/drobec)\
**Post date:** [January 21, 2017, 7:29am UTC](https://forum.ionicframework.com/t/tsconfig-json-modifications-not-working/72098/2 "2017-01-21T07:29:18Z")

</div>

tsconfig.js

```auto
{
  "compilerOptions": {
    ...
    "baseUrl": "./src",
    "paths": {
      "app/*": [
        "app/*"
      ]
    }
  },
 ...
}

```

packake.json

```auto
{
....
  "config": {
    "ionic_webpack": "./config/webpack.config.js"
  }
}

```

Copy webpack.config.js from node\_modules/@ionic/app-scripts/config/webpack.config.js to config/webpack.config.js and add resolve.alias for app

```auto
  resolve: {
    extensions: ['.ts', '.js', '.json'],
    modules: [path.resolve('node_modules')],
    alias: { app: path.resolve('src/app') },
  },

```

---

<div class="post-metadata">

**Author:** ![NoelDeMartin](https://avatars.discourse-cdn.com/v4/letter/n/46a35a/32.png) [@NoelDeMartin](https://forum.ionicframework.com/u/NoelDeMartin)\
**Post date:** [January 23, 2017, 9:50am UTC](https://forum.ionicframework.com/t/tsconfig-json-modifications-not-working/72098/3 "2017-01-23T09:50:17Z")

</div>

I tried exactly that and it doesn’t work. Have you tried? Could you explain why it should work? (maybe some link to any documentation).

---

<div class="post-metadata">

**Author:** ![drobec](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@drobec](https://forum.ionicframework.com/u/drobec)\
**Post date:** [January 26, 2017, 5:41am UTC](https://forum.ionicframework.com/t/tsconfig-json-modifications-not-working/72098/4 "2017-01-26T05:41:29Z")

</div>

Hi. Here is the link to the webpack [Webpack configuration - resolve alias](https://webpack.github.io/docs/configuration.html#resolve-alias). You have to add the app to the webpack config. It is working to me

Example from my code where I am calling service from ‘app/service’

```auto
import { Component, OnInit } from '@angular/core';
import { NavController, NavParams, Events } from 'ionic-angular';

import { Shop, Rating } from 'app/services';
import { ShopRatingDetailPage } from './rating-detail';

@Component({
    selector: 'page-shop-rating',
    templateUrl: 'rating.html'
})
export class ShopRatingPage implements OnInit {

```

---

<div class="post-metadata">

**Author:** ![drobec](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@drobec](https://forum.ionicframework.com/u/drobec)\
**Post date:** [January 26, 2017, 5:43am UTC](https://forum.ionicframework.com/t/tsconfig-json-modifications-not-working/72098/5 "2017-01-26T05:43:58Z")

</div>

Here is one more think which I forgotten

```auto
ionic --version
2.2.1

```

---

<div class="post-metadata">

**Author:** ![maverick09](https://avatars.discourse-cdn.com/v4/letter/m/c0e974/32.png) [@maverick09](https://forum.ionicframework.com/u/maverick09)\
**Post date:** [October 23, 2017, 11:18pm UTC](https://forum.ionicframework.com/t/tsconfig-json-modifications-not-working/72098/6 "2017-10-23T23:18:40Z")

</div>

Incase someone is having similar trouble to figure what exact changes you need to make get this working. I have posted my [answers for this problem here](https://stackoverflow.com/a/46899829/905915) :

---

<div class="post-metadata">

**Author:** ![NoelDeMartin](https://avatars.discourse-cdn.com/v4/letter/n/46a35a/32.png) [@NoelDeMartin](https://forum.ionicframework.com/u/NoelDeMartin)\
**Post date:** [December 20, 2017, 6:58am UTC](https://forum.ionicframework.com/t/tsconfig-json-modifications-not-working/72098/7 "2017-12-20T06:58:41Z")

</div>

This has also been solved in the github issue: [https://github.com/ionic-team/ionic-cli/issues/1809](https://github.com/ionic-team/ionic-cli/issues/1809)
