react-spring: Breaks build using latest Babel

Toplevel Unhandled rejection { Error: Cannot find module '@babel/runtime/helpers/builtin/extends'
   at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/node_modules/react-spring/dist/web.cjs.js:7:32)
...

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 18 (12 by maintainers)

Commits related to this issue

Most upvoted comments

I had a similar issue after upgrading my dependencies today. 2 out 3 installed packages that depend on @babel/runtime are using different versions of it:

viewstools [master*] $ find node_modules -maxdepth 2 -name package.json -exec grep "@babel/runtime" {} \; -print

    "@babel/runtime": "7.0.0-beta.42",
node_modules/react-scripts/package.json
    "@babel/runtime": "7.0.0-beta.42",
node_modules/react-error-overlay/package.json
    "@babel/runtime": "7.0.0-rc.3"
node_modules/react-spring/package.json

The one from react-scripts wins -I’m using react-scripts@next. react-scripts is a direct dependency of the project and react-spring is included through another package. I wonder if it has anything to do with that.

It might also be a module resolution issue because react-spring has the right babel package installed on its node_modules.

Installing @babel/runtime in my own package and pinning it to 7.0.0-rc.3 doesn’t fix it either. After doing this, 7.0.0-rc.3 is installed in the main node_modules and 7.0.0-beta.42 is inside react-scripts/node_modules. However, the resolution still fails. If I were to require @babel/runtime/helpers/builtin/extends.js in a node repl, it finds it alright. So I’m thinking, might this be an issue with how webpack is resolving the modules?

The only workaround I could find so far is to remove the older version of @babel/runtime inside react-scripts/node_modules. Hopefully libraries upgrading to the soon to be released (this week it seems?) babel 7 will sort these inconsistencies out.

This ended up being more of a brain dump, it may help others that are stuck with the same issue!