Ionic-app-scripts: Support Path mappings

Created on 9 Oct 2016  路  5Comments  路  Source: ionic-team/ionic-app-scripts

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/
http://ionicworldwide.herokuapp.com/

Short description of the problem:

TypeScript version 2+ adds support for path mapping. This feature allows as to create aliases for files/folders (more info).

Currently this feature is broken for ionic-app-scripts build because folder structure is different in .tmp folder than in source folder (basically src is copied to .tmp).
ngc step fails because it can't correctly resolve imports using path mapping

What behavior are you expecting?

In tsconfig.json copied to .tmp, compilerOptions.baseUrl is set to '.' so that path mappings work correctly.

Steps to reproduce:
1.
2.
3.

insert any relevant code between the above and below backticks

Which @ionic/app-scripts version are you using?
v0.0.30

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)

One possible solution is to:

  1. Add possibility of changing compilerOptions.baseUrl via own config file for ngc.
  2. Change conf/ngc.conf.js with compilerOptions.baseUrl set to '.'
  3. Change template of projects generated via ionic-cli to have tsconfig.json generated as such:
{
   "compilerOptions": {
      ...
      "baseUrl": "./src"

This change will reflect folder structure of generated .tmp by ngc step of ionic-scripts's build and will help future projects.

enhancement

Most helpful comment

@ramonornela yes, build dev doesn't use .tmp as in changelog.

I've meant build prod which still uses .tmp (as seen here copySrcTsToTmpDir) because it uses angular compiler as opposed to dev. As of version v0.0.30 on my CI and local machine .tmp is still created and used.

All 5 comments

I've implemented changes described in proposed solution's points 2 & 3. PR: #126

@rkostrzewski 0.0.29 not fix this see CHANGELOG not is using more the folder .tmp 馃槈

Thanks

@ramonornela yes, build dev doesn't use .tmp as in changelog.

I've meant build prod which still uses .tmp (as seen here copySrcTsToTmpDir) because it uses angular compiler as opposed to dev. As of version v0.0.30 on my CI and local machine .tmp is still created and used.

@rkostrzewski,

I don't think we are going to support this in the near future so I'm going to close this issue. Maybe we'll reconsider in the future if more people are asking for it.

Thanks,
Dan

+1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brandyscarney picture brandyscarney  路  4Comments

NoNameProvided picture NoNameProvided  路  4Comments

danbucholtz picture danbucholtz  路  4Comments

hermitdemschoenenleben picture hermitdemschoenenleben  路  3Comments

nalkon picture nalkon  路  4Comments