Skip to content

ng serve / ng test - import resolving difference ? #3533

Description

@vfedoriv

Please provide us with the following information:

OS?

Windows 10

Versions.

angular-cli: 1.0.0-beta.22-1
node: 7.2.0
os: win32 x64

Repro steps.

This import work with ng serve and not work with ng test:

import {environment} from 'environments/environment';
@Injectable()
export class OwnerService {
private entity_url = environment.REST_API_URL + 'owners';

When start ng test :

ERROR in ./src/app/owners/owner.service.ts
Module not found: Error: Can't resolve 'environments/environment' in 'D:\eclipse\workspace\spring-petclinic-angular2\src\app\owners'
@ ./src/app/owners/owner.service.ts 15:20-55
@ ./src/app/app.component.ts
@ ./src/app/app.component.spec.ts
@ ./src \.spec\.ts
@ ./src/test.ts

When I change import as

import {environment} from './../../environments/environment'

work ok for both (but it's lo-o-ong :) )

File environment.ts in src/environments/ directory.

Webpack config difference or something relate to ##2470 ?

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

    needs: repro stepsWe cannot reproduce the issue with the information given

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions