Closed antongolub closed 11 months ago
No thanks. This is an ESM package and you are expected to use moduleResolution: node16
.
https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
Ok, how about deprecating 12.1.1 and rereleasing it as 13.0.0? 12.1.1 — was an unexpected breaking change.
Node16
is not just a minor tsconfig tweak up, it enforces to declare .js
file extensions explicitly for the entire ts project codebase.
@sindresorhus, The problem can be solved on our side, of course, but all available options are quite expensive to apply immediately to each affected point:
1) pin version / use yarn resolutions / npm overrides / patch lockfiles
2) patch packuments on proxy registry to omit >= 12.1.1
3) apply patch-package
4) switch moduleResolution
to node16/nodenext
, inject .js
extensions to TS codebase
5) switch moduleResolution
to bundler
(requires TS >=5.0)
6) override libdefs in place
// meow.d.ts
declare module "meow" {
import type * as meow from 'meow/build/index.d.ts'
export = meow
}
The change that defined exports
in package.json was released with v11, in a major version, a long time ago. The change in 12.1.1 was techincally not breaking. It only breaks because you were using the package even though your project is not ESM.
I suggest pinning the version until you move to ESM.
you were using the package even though your project is not ESM
I'm afraid, our case is a bit exotic: we use ESM ("exports, type: module" in pkg.json, "module": "esnext" in tsconfig), but we do not inject .js
extensions to ts
files. Instead, we use tsc-esm-fix for post-build patching.
12.1.1 brings a new types location, which differs from the default
./index.d.ts
, so now it breaks transpilation for many legacy tsconfigs. Let's keep it compatible.https://github.com/microsoft/TypeScript/issues/51862