tsc-esm-fix
Advanced tools
Comparing version 2.12.1 to 2.12.2
{ | ||
"git": { | ||
"commitId": "0c5315f3af1e312aa49185d1f18e032fb12704eb", | ||
"commitId": "62314b8c887c73b5e44b26110f8132b9875a0b04", | ||
"repoUrl": "https://github.com/antongolub/tsc-esm-fix", | ||
"repoName": "antongolub/tsc-esm-fix" | ||
}, | ||
"date": "2022-04-07T20:58:49.253Z" | ||
"date": "2022-04-08T06:36:52.668Z" | ||
} |
@@ -0,1 +1,3 @@ | ||
## [2.12.2](https://github.com/antongolub/tsc-esm-fix/compare/v2.12.1...v2.12.2) (2022-04-08) | ||
## [2.12.1](https://github.com/antongolub/tsc-esm-fix/compare/v2.12.0...v2.12.1) (2022-04-07) | ||
@@ -2,0 +4,0 @@ |
{ | ||
"name": "tsc-esm-fix", | ||
"version": "2.12.1", | ||
"version": "2.12.2", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -24,8 +24,9 @@ # tsc-esm-fix | ||
### Problem | ||
This workaround is aimed to bypass a pair of **tsc** and **ts-jest** issues _right here and right now_. | ||
This workaround is aimed to bypass a bunch of **tsc**, **ts-jest** and **esbuild** issues _right here and right now_. | ||
* [TS/13422](https://github.com/microsoft/TypeScript/issues/13422) / [TS/16577](https://github.com/microsoft/TypeScript/issues/16577): **tsc** should add `.js` extensions for relative module paths if compiled as [`es2020/esnext`](https://www.typescriptlang.org/tsconfig/#module). | ||
* [ts-jest/1174](https://github.com/kulshekhar/ts-jest/issues/1174): `import.meta` is not allowed. | ||
* [esbuild/1043](https://github.com/evanw/esbuild/issues/1043): empty output for interface files that breaks reimport. | ||
### Solutions | ||
1. Post-process tsc-compiled outputs everytime after the build. | ||
1. Post-process tsc-compiled outputs each time after build. | ||
2. Patch project sources once as Sindre recommends in [ESM migration guide](https://github.com/sindresorhus/meta/discussions/15) | ||
@@ -43,3 +44,3 @@ | ||
* Searches and replaces `__dirname` and `__filename` refs with `import.meta`. | ||
* Fills blank files with `export {}` (esbuild issue) | ||
* Fills blank files with `export {}` ([esbuild issue 1043](https://github.com/evanw/esbuild/issues/1043)) | ||
* Patches `require` statements with new file refs if ext changes ([hybrid/dual pkg](https://2ality.com/2019/10/hybrid-npm-packages.html)) | ||
@@ -207,5 +208,6 @@ * Changes file extensions (applied to local deps only). | ||
## References | ||
* [TypeScript/issues/13422: TypeScript and script type="module"](https://github.com/microsoft/TypeScript/issues/13422) | ||
* [TypeScript/issues/13422: TypeScript and script `type="module"`](https://github.com/microsoft/TypeScript/issues/13422) | ||
* [TypeScript/issues/28288: Feature: disable extensionless imports](https://github.com/microsoft/TypeScript/issues/28288) | ||
* [ts-jest/issues/1174: import.meta not allowed](https://github.com/kulshekhar/ts-jest/issues/1174) | ||
* [esbuild/issues/1043: Empty file bundles as `{ default: {} }`](https://github.com/evanw/esbuild/issues/1043) | ||
* [stackoverflow.com/how-to-use-import-meta-when-testing-with-jest](https://stackoverflow.com/questions/64961387/how-to-use-import-meta-when-testing-with-jest) | ||
@@ -212,0 +214,0 @@ * [Pure ESM package](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
94736
219