Skip to content

Strange behaviour with src/app imports #18532

@napei

Description

@napei

🐞 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

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