-
-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use ts-bridge
for building
#182
Conversation
I'm noticing that the In any case I ran
Seems good to me :) |
This is intentional. The ESM module resolution algorithm is quite complicated, but if a file is using So in theory this lets Node.js (or whatever module resolution algorithm) take the happy path, and continue parsing the file using the module type implied by the file extension, and skip looking at other files that can determine if something is ESM or CJS. It also removes the need for checking different file extensions. Node.js might look for So theoretically it's slightly more performant to use file extensions everywhere. I doubt it makes any significant difference in practice, but as far as I know there's no downsides to using file extensions everywhere either. |
) ## Explanation As part of our OKR for upgrading TypeScript to v5.0+ (Q2 2024 O3KR4), we are updating our core dependencies to generate builds and type declarations for both CJS and ESM. ## References - Same update made to `@metamask/utils`: MetaMask/utils#182 - Required to update core repo's `moduleResolution` setting to `NodeNext`: - Blocks: MetaMask/core#3651 ## Changelog ### Added - Newly exports the following types: `AnyStruct`, `EnumSchema`, `InferStructTuple`, `IsExactMatch`, `IsMatch`, `IsRecord`, `IsTuple`, `ObjectSchema`, `OmitBy`, `Optionalize`, `PickBy`, `Simplify`, `UnionToIntersection`.
Turns out
tsup
wasn't the perfect solution either (mainly due to problems with ESBuild), so we decided to switch to a different solution, hopefully for the last time.ts-bridge
also simplifies the build process a little bit, as we no longer need a separate config.Output from
attw
:@metamask/utils/node
is failing because Node.js 10 doesn't supportpackage.json
exports. Node 16 (EOL) and higher support this, so that's a non-issue.