Skip to content

Improve absolute import parsing for editors by moving baseUrl #7964

Closed

Description

@nitzano

Bug Report or Feature Request (mark with an x)

- [] bug report -> please search issues before submitting
- [x] feature request

Versions.

@angular/cli: 1.4.4
node: 6.11.3
os: linux x64
@angular/animations: 4.4.4
@angular/common: 4.4.4
@angular/compiler: 4.4.4
@angular/core: 4.4.4
@angular/forms: 4.4.4
@angular/http: 4.4.4
@angular/platform-browser: 4.4.4
@angular/platform-browser-dynamic: 4.4.4
@angular/router: 4.4.4
@angular/cli: 1.4.4
@angular/compiler-cli: 4.4.4
@angular/language-service: 4.4.4
typescript: 2.3.4

Repro steps.

This improvements refers mainly to vscode/#24362 but i think it will be reproduced by other editors in the future as well. Currently the main (and only) typescript config file parsed by editors is tsconfig.json. Since the files ./src/tsconfig.app.json and ./src/tsconfig.spec.json both contains"baseUrl": "./" but there is no baseUrl property in ./tsconfig.json which they both extend there is no way for the common editor to know what the main baseUrl is and it will struggle with resolving and refactoring absolute imports (although compiling with ng build works fine).

The log given by the failure.

For example just "out of the box" app after ng new and changing one relative import to absolute one produces :

import_fail

Desired functionality.

if (as I wrote here) the baseUrl property will be moved from ./src/tsconfig.app.json and ./src/tsconfig.spec .json files to ./tsconfig.json and it will hold there "baseUrl": "./src/" it will solve the issue and will create better parsing for other editors in the future.

Mention any other details that might be useful.

  1. vscode/24362
  2. vscode/12463

Activity

  1. added this to the needsTriage milestone on Oct 1, 2019
  2. added
    featureLabel used to distinguish feature request from other issues
    on Oct 1, 2019
  3. modified the milestones: needsTriage, Backlog on Oct 1, 2019
  4. angular-robot commented on Feb 1, 2022

    @angular-robot
    Contributor

    Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

    Find more details about Angular's feature request process in our documentation.

  5. modified the milestones: Backlog, needsTriage on Feb 1, 2022
  6. angular-robot commented on Feb 21, 2022

    @angular-robot
    Contributor

    Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

    We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

    You can find more details about the feature request process in our documentation.

  7. added
    feature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authors
    and removed
    feature: votes requiredFeature request which is currently still in the voting phase
    on Feb 21, 2022
  8. alan-agius4 commented on Oct 3, 2023

    @alan-agius4
    Collaborator

    Closing as I believe this is solved by #25934. If the issue still persists please open a new issue.

  9. angular-automatic-lock-bot commented on Nov 3, 2023

    @angular-automatic-lock-bot

    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.

  10. locked and limited conversation to collaborators on Nov 3, 2023
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

    area: @schematics/angularfeatureLabel used to distinguish feature request from other issuesfeature: insufficient votesLabel to add when the not a sufficient number of votes or comments from unique authorsneeds: investigationRequires some digging to determine if action is needed

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions