Material-ui: core 1.5.1 breaks icons 1.*

Created on 22 Aug 2018  路  15Comments  路  Source: mui-org/material-ui

Building breaks for users of @material-ui/icons 1.1.0 with error

Error: Cannot find module '@babel/runtime/helpers/builtin/interopRequireDefault' from '.../node_modules/@material-ui/icons'

@material-ui/icons 1.1.0 declares that it works with any core of v1

  "peerDependencies": {
    "@material-ui/core": "^1.0.0-rc.0",

but that's not true for 1.5.1.
1.5.1 depends on @babel/runtime 7.0.0-rc.1 as opposed to 7.0.0-beta.42 in 1.5.0. 7.0.0-rc.1 changes the location of interopRequireDefault.

Expected Behavior

icons v1 can be used

Current Behavior

Error: Cannot find module '@babel/runtime/helpers/builtin/interopRequireDefault' from '.../node_modules/@material-ui/icons'

Steps to Reproduce

https://codesandbox.io/s/oow4nvrm36

Proposal

Release icons 1.1.1 that would work with core 1.5.1 and babel core 7.0.0-rc.1

bug 馃悰

Most helpful comment

I'm concerned about this.

As @material-ui/[email protected] is a breaking change over 1.1, the fact that @material-ui/[email protected] requires us to upgrade @material-ui/icons to 2.0 IS a breaking change for the core. So core 1.5.1 should have been a 2.0 in that regard.

Alternatively, please revert the babel upgrade in 1.5.1, or backport the material-ui/icons fix to the 1.x branch.

All 15 comments

Workaround that works for me

  "dependencies": {
    ...
    "@material-ui/core": "1.5.0",
    "@material-ui/icons": "1.1.0",
     ...
  },
  "optionalDependencies": {
    "@babel/runtime": "7.0.0-beta.42",
    "react-event-listener": "0.6.2"
  }

~Should be fixed by #12605.~

Oh no, my bad. It's @material-ui/[email protected] that is broken in the first place. It was fixed one month ago with: #12170. You just need to upgrade @material-ui/icons.

@oliviertassinari , do you say icons v1 is not supported any more? That's sad because icons v2 do not work with react 15. See https://codesandbox.io/s/ymmnjxn6xv.

@sergey-su We don't support older versions. We almost never did. React 15.x support stopped 4 months ago.

I'm concerned about this.

As @material-ui/[email protected] is a breaking change over 1.1, the fact that @material-ui/[email protected] requires us to upgrade @material-ui/icons to 2.0 IS a breaking change for the core. So core 1.5.1 should have been a 2.0 in that regard.

Alternatively, please revert the babel upgrade in 1.5.1, or backport the material-ui/icons fix to the 1.x branch.

@fzaninotto Fair point. I guess we can make a patch release for @material-ui/[email protected].

@material-ui/[email protected] is out with the fix, I hope that help.

Thanks!

Hi @oliviertassinari. I'm trying to understand the fix in 1.1.1 - is it supposed to have republished the package having been built with babel 7.0.0-rc.1? The package.json still specifies a dependency on 7.0.0-beta.42 and trying to use 1.1.1 still has the same Can't resolve '@babel/runtime/helpers/builtin/interopRequireDefault error as before when used with babel 7.0.0

@anuraaga v1.1.1 is about locking the babel runtime version to the version that was used to generate the code: beta.42. Make sure the issue isn't coming from another dependency.

But the dependency that causes the problem is @material-ui/core itself since 1.5.1 depends on 7.0.0-rc.1, and when both core 1.5.1 and icons 1.1.1 are depended on, babel resolves to 7.0.0-rc.1. It's of course possible to fix the version to 7.0.0-beta.55 using yarn's resolutionDependencies, which is a workaround, but it seems like without such workarounds, core 1.5.1 and icons 1.1.1 still aren't compatible?

@anuraaga Unless you are flattening your node_modules, multiple versions of babel will be installed, it shouldn't be an issue at all.

@anuraaga, I confirm this issue @oliviertassinari, had installed both core 1.5.1 and icons 1.1.1 and the issue still occur

I confirm this fix by @oliviertassinari isn't effective. Using core v1.5.1 with icons v1.1.1 still fails with a Babel error

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iamzhouyi picture iamzhouyi  路  3Comments

activatedgeek picture activatedgeek  路  3Comments

revskill10 picture revskill10  路  3Comments

ericraffin picture ericraffin  路  3Comments

finaiized picture finaiized  路  3Comments