Skip to content
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

fix: add @babel/runtime to peerDeps and devDeps #120

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

legobeat
Copy link
Contributor

@legobeat legobeat commented Feb 3, 2024

This package has an undeclared peerDependency on @babel/runtime. When trying to require('@metamask/eth-method-registry') as a module from an otherwise empty test project we get the following error (and can see the corresponding usage at top of the bundled entrypoint):

$ node index.js
node:internal/modules/cjs/loader:1031
  throw err;
  ^

Error: Cannot find module '@babel/runtime/helpers/interopRequireDefault'
Require stack:
- node_modules/@metamask/eth-token-tracker/dist/index.js
- index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1028:15)
    at Function.Module._load (node:internal/modules/cjs/loader:873:27)
    at Module.require (node:internal/modules/cjs/loader:1100:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at Object.<anonymous> (node_modules/@metamask/eth-token-tracker/dist/index.js:3:30)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
    at Function.Module._load (node:internal/modules/cjs/loader:911:12)
    at Module.require (node:internal/modules/cjs/loader:1100:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'node_modules/@metamask/eth-token-tracker/dist/index.js',
    'index.js'
  ]
}

This is the case for version 4.0.1 through 7.0.1. In 4.0.0 and lower, we don't see the error because @babel/runtime@^7.5.5 got pulled in separately as a transitive runtime dependency from older versions of eth-block-tracker, which removed it as of v5.0.0. (#86)

I picked ^7.21.0, since @babel/runtime@7.21.0 is what's already present in the lockfile of this package and used in tests as of #95 (see as for why not lower).

Fixed

  • Add missing peerDependency @babel/runtime

@legobeat legobeat mentioned this pull request Feb 3, 2024
1 task
@legobeat legobeat marked this pull request as ready for review February 3, 2024 10:00
@legobeat legobeat requested a review from a team as a code owner February 3, 2024 10:00
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

@legobeat legobeat merged commit 9fa4902 into MetaMask:main Feb 5, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants