es-abstract: es-abstract@1.17.0-next.1 release breaking old applications

I am currently experiencing an issue where which was already raised by another person on stackoverflow where the latest release es-abstract@1.17.0-next.1 which is apparently being auto-installed by common libraries (redux-form, react-date) as a semver range.

Upon building the frontend with webpack and webpack dev server the following error occurs:

Error in ./~/object.entries/implementation.js
Module not found: Can't resolve 'es-abstract/2019/RequireObjectCoercible' in 'someDummyPath/host/client/node_modules/object.entries'

Upon investigating whether the path is really not existing I found out that it is indeed present -> therefore I don’t quite understand why this not being resolved properly.

We are using npm modules on a locked version state which stayed the same for a few years - but some of them install dependencies using semver ranges which leads to es-abstract@1.17.0-next.1 being installed as a peer dependency.

Since we arent the owner of the npm modules we can’t simply manually requirea locked version.

├─┬ INTERNAL_LIBRARY
│ └─┬ react-dates@10.1.1
│   ├─┬ airbnb-prop-types@2.15.0
│   │ ├─┬ function.prototype.name@1.1.2
│   │ │ └── es-abstract@1.17.0-next.1 
│   │ └─┬ object.entries@1.1.1
│   │   └── es-abstract@1.17.0-next.1 
│   └─┬ array-includes@3.1.0
│     └── es-abstract@1.17.0-next.1 
└─┬ redux-form@6.6.2
  └─┬ deep-equal@1.1.1
    └─┬ regexp.prototype.flags@1.3.0
      └── es-abstract@1.17.0-next.1 

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 6
  • Comments: 31 (11 by maintainers)

Most upvoted comments

I’m having the same issue

In our case we had to change webpack resolve.modules to include 'node_modules' instead of path.resolve(__dirname, 'node_modules') in order for it to find this module as a nested dependency. (1.17.0 is not deduped below)

@myteam/myapp@0.7.0
├─┬ @myteam/mycomponent@0.7.0
│ └─┬ react-vis@1.11.7
│   └─┬ deep-equal@1.1.1
│     └─┬ regexp.prototype.flags@1.3.0
│       └── es-abstract@1.17.0 
├─┬ enzyme@3.10.0
│ ├─┬ array.prototype.flat@1.2.1
│ │ └── es-abstract@1.13.0 
│ ├─┬ object.entries@1.1.0
│ │ └── es-abstract@1.13.0  deduped
│ ├─┬ object.values@1.1.0
│ │ └── es-abstract@1.13.0  deduped
│ └─┬ string.prototype.trim@1.2.0
│   └── es-abstract@1.13.0  deduped
├─┬ enzyme-adapter-react-16@1.14.0
│ └─┬ enzyme-adapter-utils@1.12.0
│   ├─┬ airbnb-prop-types@2.15.0
│   │ └─┬ array.prototype.find@2.1.0
│   │   └── es-abstract@1.13.0  deduped
│   └─┬ object.fromentries@2.0.0
│     └── es-abstract@1.13.0  deduped
└─┬ jest@24.8.0
  └─┬ jest-cli@24.8.0
    └─┬ realpath-native@1.1.0
      └─┬ util.promisify@1.0.0
        └─┬ object.getownpropertydescriptors@2.0.3
          └── es-abstract@1.13.0  deduped

All. Check your configuration for module directories https://jestjs.io/docs/en/configuration#moduledirectories-arraystring for jest and https://webpack.js.org/configuration/resolve/ for webpack. Jest docs says An array of directory names to be searched recursively up and Setting this option will override the default, which happens to be node_modules.

@ljharb is right when he says that

if node_modules/array.prototype.flat/node_modules/es-abstract exists, a require from array.prototype.flat will check it’s node_modules first

I fixed that in jest in a broken scenario and it works fine now.

You updated minor version and you use #next version tag on some dependecies, I think that’s not good way, you should use #next tag for this testing phase, for example package function.prototype.name (below is package-lock.json). I suggest to revert changes and create next tag for dependencies that use es-abstract#next

Previous version

"function.prototype.name": {
      "version": "1.1.1",
      "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.1.tgz",
      "integrity": "sha512-e1NzkiJuw6xqVH7YSdiW/qDHebcmMhPNe6w+4ZYYEg0VA+LaLzx37RimbPLuonHhYGFGPx1ME2nSi74JiaCr/Q==",
      "requires": {
        "define-properties": "^1.1.3",
        "function-bind": "^1.1.1",
        "functions-have-names": "^1.1.1",
        "is-callable": "^1.1.4"
      }
    }

New minor version

"function.prototype.name": {
      "version": "1.1.2",
      "resolved": "https://registry.npmjs.org/function.prototype.name/-/function.prototype.name-1.1.2.tgz",
      "integrity": "sha512-C8A+LlHBJjB2AdcRPorc5JvJ5VUoWlXdEHLOJdCI7kjHEtGTpHQUiqMvCIKUwIsGwZX2jZJy761AXsn356bJQg==",
      "requires": {
        "define-properties": "^1.1.3",
        "es-abstract": "^1.17.0-next.1",
        "functions-have-names": "^1.2.0"
      },
      "dependencies": {
        "es-abstract": {
          "version": "1.17.0-next.1",
          "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.17.0-next.1.tgz",
          "integrity": "sha512-7MmGr03N7Rnuid6+wyhD9sHNE2n4tFSwExnU2lQl3lIo2ShXWGePY80zYaoMOmILWv57H0amMjZGHNzzGG70Rw==",
          "requires": {
            "es-to-primitive": "^1.2.1",
            "function-bind": "^1.1.1",
            "has": "^1.0.3",
            "has-symbols": "^1.0.1",
            "is-callable": "^1.1.4",
            "is-regex": "^1.0.4",
            "object-inspect": "^1.7.0",
            "object-keys": "^1.1.1",
            "object.assign": "^4.1.0",
            "string.prototype.trimleft": "^2.1.0",
            "string.prototype.trimright": "^2.1.0"
          }
        }
      }
    },
Quick solution is that you override version buy manually check package-lock.json and find all packages that use es-abstract@next and put them as your project dependency with fixed version for example ``` npm i -D function.prototype.name@1.1.1 ```

I’d go up to v1.18.5 at this point 😃

Not sure what the real issue is, but @ninosaurus’s suggestion worked.

I needed to override both dependencies from the error:

npm i -D function.prototype.name@1.1.1 npm i -D object.entries@1.1.0

Yup that’s works if you just use just airbnb-prop-types@2.15.0 lib that depends on

"function.prototype.name": "^1.1.1",
"object.entries": "^1.1.0",

Not sure what the real issue is, but @ninosaurus’s suggestion worked.

I needed to override both dependencies from the error:

npm i -D function.prototype.name@1.1.1 npm i -D object.entries@1.1.0

I’ve tried making a new clean project and importing only the library that uses airbnb-prop-types and object.entries.

While running: webpack --mode=production there is no error, but as soon as I switch to webpack --mode=development --watch I get the same error as in the original post.

ERROR Error: Cannot find module ‘es-abstract/2020/RequireObjectCoercible’

i used yarn add es-abstract@1.18.0 to resolve this issue in the main repo