GitXplorerGitXplorer
h

typescript-dual-package-esnext-bundler-nodenext

public
0 stars
0 forks
0 issues

Commits

List of commits on branch main.
Verified
a1d0620d466ffe2f82c20d82cec04ad9386f66ca

Update dependencies

hhaines committed 5 months ago
Verified
c4155db11052da63fadffe03540f28d93d377296

Minimal reproduction

hhaines committed a year ago

README

The README file for this repository.

TypeScript incorrectly loads CJS types in mixed ESNext/Bundler and NodeNext multi-project build

This repo demonstrates an issue with a dual-package dependency (dep) in a multi-project build, where one project (app) has ESNext module and Bundler module resolution, while another (lib) has NodeNext module and module resolution.

Despite everything being set up to use ESM, somehow TypeScript resolves the CJS types when transitively importing the dual package.

$ npm install

$ npm run build

> build
> tsc --build

app/src/index.ts:4:7 - error TS2322: Type '"CJS"' is not assignable to type '"ESM"'.

4 const test: ModuleType = moduleType;
        ~~~~


Found 1 error.