Skip to content

Strange behaviour with src/app imports #18532

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
napei opened this issue Aug 14, 2020 · 2 comments
Closed

Strange behaviour with src/app imports #18532

napei opened this issue Aug 14, 2020 · 2 comments

Comments

@napei
Copy link

napei commented Aug 14, 2020

🐞 bug report

Affected Package

Not too sure what package it is covered by in this ecosystem.

Description

So I structure my apps like src/app/pages/page.module and src/app/core/models/test.model.ts and usually, using an import in a module like import {thing} from 'src/app/core/models/test.model works fine, however when lazy loading that module in app-routing.module.ts, and commenting out the route that loads the import code, VS Code Insiders, or typescript, whichever, cannot pick up on that import for some reason.

I haven't had this before, however I also haven't commented out routes from my projects before today so it may or may not be present in older versions.

Everything still builds fine, and ng serve works too, which leads me to think that it's either a IDE thing, or a typescript thing.

File structure:

src
├── app
│   ├── core
│   │   └── models
│   │       └── test.model.ts
│   ├── pages
│   │   └── test
│   │       ├── test.component.css
│   │       ├── test.component.html
│   │       ├── test.component.ts
│   │       └── test.module.ts
│   ├── app-routing.module.ts
│   ├── app.component.css
│   ├── app.component.html
│   ├── app.component.ts
│   └── app.module.ts
├── assets
│   └── .gitkeep
├── environments
│   ├── environment.prod.ts
│   └── environment.ts
├── favicon.ico
├── index.html
├── main.ts
├── polyfills.ts
├── styles.css
└── test.ts

🔬 Minimal Reproduction

https://github.com/napei/ng-test-linting

Code on the master branch works as expected, and code on the broken branch is, by name, broken.

Also, here is a short demo, in case nobody can repro. https://www.youtube.com/watch?v=RXTsaZA6Y88

Changing the import to import { TestInterface } from '../../core/models/test.model'; works in both cases, however if using src/app works at all it should probably work both ways, all the time.

🌍 Your Environment

Angular Version:

image

Anything else relevant?

I don't know if this is a language service issue, but this is the log for the language service extension version 0.1000.7
https://pastebin.com/raw/TqsF7u07

I am currently using VS Code - Insiders 1.49

@alan-agius4 alan-agius4 transferred this issue from angular/angular Aug 14, 2020
@alan-agius4
Copy link
Collaborator

Hi @napei,

This should be fixed via #18478 in 10.1 which will be released as a stable version end of this month.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants