snaps icon indicating copy to clipboard operation
snaps copied to clipboard

Set tsconfig `module{,Resolution}` options to `NodeNext`

Open MajorLift opened this issue 1 year ago • 2 comments

As part of the Wallet Framework Team's OKR (Q2 2024 O3KR4) for upgrading TypeScript to v5.0+ in the core monorepo, we are updating dependencies of the core repo so that they generate builds and type declarations for both CJS and ESM.

The purpose of this update is to ensure that these dependencies can be imported into projects using the Node16 or NodeNext options for their moduleResolution TypeScript compiler setting.

Because the effects of these changes apply to nested dependencies as well, we are enabling the NodeNext moduleResolution option in all affected repos, to ensure that all projects further downstream can be set to NodeNext without issue.

Looking upstream, we also need to make changes for dependencies that are ESM-only. Because snaps is a CJS project, we either need to update these dependencies to expose a CJS build, or replace our static import statements for these dependencies with dynamic import syntax.

See https://www.typescriptlang.org/docs/handbook/modules/reference.html#interoperability-rules

References

  • Closes https://github.com/MetaMask/snaps/issues/2444
  • Succeeds https://github.com/MetaMask/snaps/pull/2445
  • Blocked by ESM-only deps @minoru/react-dnd-treeview, react-dnd, terser
    • Build errors: https://github.com/MetaMask/snaps/actions/runs/9815331024/job/27104249292?pr=2514

MajorLift avatar Jun 25 '24 00:06 MajorLift

New and removed dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/[email protected] Transitive: network +9 1.81 MB metamaskbot

🚮 Removed packages: npm/@metamask/[email protected]

View full report↗︎

socket-security[bot] avatar Jun 25 '24 01:06 socket-security[bot]

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

socket-security[bot] avatar Jun 25 '24 01:06 socket-security[bot]

Closed by https://github.com/MetaMask/snaps/pull/2682

MajorLift avatar Sep 11 '24 20:09 MajorLift