Skip to content

tsconfig.json template doesn't have the baseUrl option #26549

@changhuixu

Description

@changhuixu

Command

new

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

v16

Description

The tsconfig.json file had an option in v16: "baseUrl" = "./" by default. But now in v17, this option is no longer there.

Without it, the import statement in TypeScript files would change from
import { SharedModule } from 'src/app/shared';
to
import { SharedModule } from '../../shared';

In some cases, the nested folders will increase the path to be many ../../../ instead of simply src/app/shared.
It becomes a pain to manage the relative path.

The baseUrl option is removed in this commit 419b5c1

related to #18834

There must be a reason for you to remove it, as the commit message says "this also enables better auto-import suggestions". Could you explain it more?

From the screenshot below, it only says that "can be", which doesn't mean "should not".

image

Minimal Reproduction

related to #18834

Exception or Error

ref. description session
![image](https://github.com/angular/angular-cli/assets/16184464/3a8541a2-4338-49c0-a5b2-fb3e60a99741)

Your Environment

Angular CLI: 17.0.5
Node: 20.9.0
Package Manager: npm 9.8.1
OS: win32 x64

Anything else relevant?

d

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