Angular-cli: Relative tsconfig paths doesn't work

Created on 21 Mar 2018  路  6Comments  路  Source: angular/angular-cli

Versions

1.7.0 >

Repro steps

After this PR https://github.com/angular/angular-cli/pull/9787 the tsconfig paths doesn't work anymore.
Why has been added this limitation in the paths mapping? It sounds like a problem to me when you develop specially a component library.

For example in my project I have a stucture like:

MY-PROJECT
|->MY-DEMO-APP
|->MY-LIB-COMPONENT

Now if I want point my lib component from my demo app (without publish or at least build the library) what I am currently doing is to relatively point from the tsconfig to my lib.(Otherwise it will get the node_modules version of my library).

Using the tsconfig to map a relative lib has a lot of advantages during the development; in particular the watcher that will keep to check if I modify something in my lib and will let me test it in my demo app.

This technique is used also by:

material 2:
https://github.com/angular/material2/blob/master/src/demo-app/tsconfig-aot.json

Alfresco ADF (The project where I work):
https://github.com/Alfresco/alfresco-ng2-components/tree/master/demo-shell

This solution will not help all the projects that use the angular cli and develop a library

Observed behavior

<!-- Normally this includes a stack trace and some more information. -->

Desired behavior


tsconfig relative path should works normally, if a user doesn't want it it can easily not set it.
If it set it wrongly it' his fault 馃樃

Mention any other details that might be useful (optional)

Most helpful comment

Guys can we have some discussions around it? @filipesilva @hansl it will be critical for some projects to update whit this big limitation

All 6 comments

I have the same issue... will it be fixed in next version?

Guys can we have some discussions around it? @filipesilva @hansl it will be critical for some projects to update whit this big limitation

we are experiencing this same issue when trying to initiate an app-shell with tsconfig paths included in our projects. isn't there a solution in adding a path property to app-shell in angular.json?

would love to see any assistance here

@clydin can you add some context here please?

TypeScript path mappings are only intended to function on non-relative imports. For further details please see the relevant TypeScript documentation: https://www.typescriptlang.org/docs/handbook/module-resolution.html

Also Material (https://github.com/angular/material2/blob/master/src/demo-app/tsconfig-aot.json) only maps non-relative imports; not relative imports.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings