Skip to content

Unrecognized self-referencing @scope/package聽#46175

Description

Bug Report

馃攷 Search Terms

  • self-referencing
  • self-referencing package
  • node12
  • module resolution

馃晽 Version & Regression Information

TypeScript 4.5 Beta and TypeScript Nightly

馃檨 Actual behavior

Given the next package.json:

{
    "name": "@scope/package",
    "type": "module",
    "main": "./compiled/src/index.cjs",
    "exports": {
        "import": "./compiled/src/index.js",
        "require": "./compiled/src/index.cjs"
    },
    ...
}

And the following tsconfig.json:

{
    "module": "node12",
    ...
}

The following code does not compile:

import * as src from "@scope/package"

The obtained error is Cannot find module '@scope/package' or its corresponding type declarations.

馃檪 Expected behavior

TSC currently compile self-referencing package that has unscoped names. TSC should also compile self-referencing scoped packages such as @scope/package.

Metadata

Metadata

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions