Skip to content

@docusaurus/tsconfig: baseUrl is deprecated in TypeScript 6.0 (TS5101) #11893

@mderazon

Description

@mderazon

Bug Description

@docusaurus/tsconfig sets "baseUrl": "." in its base config. Starting with TypeScript 6.0, baseUrl is deprecated and triggers a build error:

error TS5101: Option 'baseUrl' is deprecated and will stop functioning in TypeScript 7.0.
Specify compilerOption '"ignoreDeprecations": "6.0"' to silence this error.

This error surfaces in any Docusaurus project using TypeScript 6.x when running tsc --noEmit.

Root Cause

@docusaurus/tsconfig/tsconfig.json currently contains:

{
  "compilerOptions": {
    "baseUrl": ".",
    "paths": {
      "@site/*": ["./*"]
    }
  }
}

Per the TypeScript 6.0 migration guide, baseUrl was historically required to use paths, but this is no longer the case. The paths entries can simply be kept as-is without baseUrl, or baseUrl can be prepended to each entry.

Expected Behavior

tsc --noEmit passes without errors or deprecation warnings on TypeScript 6.x.

Workaround

Projects can add this to their own tsconfig.json to silence the warning:

{
  "extends": "@docusaurus/tsconfig",
  "compilerOptions": {
    "ignoreDeprecations": "6.0"
  }
}

Fix

Remove "baseUrl": "." from @docusaurus/tsconfig/tsconfig.json. The @site/* path alias should continue to work without it (TypeScript no longer requires baseUrl to be set when using paths).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its execution

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions