Closed
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
.