Closed
Labels
needs: repro stepsWe cannot reproduce the issue with the information givenWe cannot reproduce the issue with the information given
Description
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 ?
Reacted by Russell
Metadata
Metadata
Assignees
Labels
needs: repro stepsWe cannot reproduce the issue with the information givenWe cannot reproduce the issue with the information given
Activity
Juansasa commentedon Dec 14, 2016
I'm having the same problem, hopes it will be addressed soon
Igonato commentedon Dec 14, 2016
Same Issue. Brakes
app/*imports in testshansl commentedon Dec 15, 2016
Do you have a
baseUrlkey in yourtsconfig.json?vfedoriv commentedon Dec 15, 2016
tsconfig as default generated, "baseUrl": ""
hansl commentedon Dec 15, 2016
Could you provide a project that we can test against? I haven't seen that in beta 22-1 and/or Windows.
Igonato commentedon Dec 16, 2016
@hansl I was on beta 22 updated to beta 22-1 and it went away
vfedoriv commentedon Dec 16, 2016
Here test project
https://github.com/vfedoriv/test1.git
hansl commentedon Dec 16, 2016
Thanks. We'll investigate and come back.
hansl commentedon Dec 16, 2016
I found the problem with your
Using a local fix that I have to report errors more efficiently, this is what I see:
The error is "Cannot determine the module for class PageNotFoundComponent". Every components built need to be declared in an
NgModule, so this is an error.Two things you can do to fix:
main.ts(adding"files": ["main"]).Point 2 we can actually improve on by having
main.tsin our tsconfig by default when creating new apps, so we'll do that. In the meantime you have fixes for this problem and I'll close this issue as fixed.Cheers!
vfedoriv commentedon Dec 17, 2016
Well, i generate clean project w/o other logic and just add one import.
Same error with 'ng test'
Try this: https://github.com/vfedoriv/test3.git
angular-automatic-lock-bot commentedon Sep 6, 2019
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.