Skip to content

baseUrl & paths not working correctly #2634

Description

@tmansson

Please provide us with the following information:

OS?

Windows 10.

Versions.

angular-cli: 1.0.0-beta.17
node: 6.7.0
os: win32 x64

Repro steps.

Updating my app from beta.16 to beta.17, and trying to utilise the new baseUrl & paths configuration in tsconfig.json as follows:

"baseUrl": ".",
 "paths": {
   "@shared/*": [
     "app/shared/*"
   ],

When I use

import { Http } from '@angular/http';
import { StorageService } from '@shared/services';

@Injectable()
export class AuthService {
  constructor(private http: Http, private storageService: StorageService) { ... }
}

typescript and webpack compiles and builds without erros, but I get an error in chrome that says

Can't resolve all parameters for AuthService: (Http, ?)

But if I write:

import { Http } from '@angular/http';
import { StorageService } from './storage.service';

@Injectable()
export class AuthService {
  constructor(private http: Http, private storageService: StorageService) { ... }
}

it works.

AuthService and StorageService are in the same folder app/shared/services/ and there's an index.ts with export * from './storage.service'; in it, so this should work right?

Is there anything more I need to add to tsconfig.json or angular-cli.json to get it to work?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions