Material-ui: React-Transition-Group and 1.0.0 beta

Created on 1 Dec 2017  路  4Comments  路  Source: mui-org/material-ui

Dear Material-UI Community!

Big apology if this has been already addressed or discussed earlier, but I couldn't find any related thread on this so opening this ticket for your kind advise.

[X] I have searched the issues of this repository and believe that this is not a duplicate.

Attempting to use any material component from 1.0.0 beta package, such as buttons or text field with animation and ripple behavior, breaks webpack 3 builds with the following error:

ERROR in ../node_modules/material-ui-next/ButtonBase/Ripple.js
Module not found: Error: Can't resolve 'react-transition-group/Transition' in '../node_modules/material-ui-next/ButtonBase'

In order to get around with this issue, I completely removed my npm global cache, removed node_modules folder and cleared npm cache, and re-installed everything. Unfortunately none helped fixing the aforementioned issue.

My Environment

I am using React 16.0 and do NOT have react-transition-group as a dependency. Thus, I assume it comes as a dependency for material-ui-next. I am currently using both 0.19.4 and 1.0.0 beta at the same time.

  "engines": {
    "node": "6.11.2",
    "npm": "4.0.5"
  },
  "dependencies": {
    "aphrodite": "^1.2.4",
    "axios": "^0.16.0",
    "babel-cli": "^6.26.0",
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-plugin-react-transform": "^2.0.2",
    "babel-plugin-transform-decorators-legacy": "^1.3.4",
    "babel-plugin-transform-flow-strip-types": "^6.18.0",
    "babel-plugin-transform-react-constant-elements": "^6.23.0",
    "babel-plugin-transform-react-inline-elements": "^6.22.0",
    "babel-plugin-transform-react-remove-prop-types": "^0.3.3",
    "babel-preset-env": "^1.6.1",
    "babel-preset-react": "^6.24.1",
    "babel-preset-react-hmre": "^1.1.1",
    "babel-preset-stage-0": "^6.24.1",
    "bcrypt-nodejs": "0.0.3",
    "bluebird": "^3.5.1",
    "body-parser": "^1.18.2",
    "class-autobind": "^0.1.4",
    "classnames": "^2.2.3",
    "connect-mongo": "^1.3.2",
    "cookie-parser": "^1.4.3",
    "create-react-class": "^15.6.2",
    "cross-env": "^4.0.0",
    "css-loader": "^0.28.7",
    "d3": "^4.11.0",
    "draft-js": "^0.10.3",
    "draft-js-emoji-plugin": "^2.0.0-rc9",
    "draft-js-export-html": "^1.2.0",
    "draft-js-export-markdown": "^1.2.0",
    "draft-js-import-html": "^1.2.1",
    "draft-js-import-markdown": "^1.2.1",
    "draft-js-plugins-editor": "^2.0.0-rc8",
    "draft-js-utils": "^1.2.0",
    "element-resize-detector": "^1.1.12",
    "es6-promise": "^4.1.0",
    "express": "^4.16.1",
    "express-session": "^1.15.6",
    "express-socket.io-session": "^1.3.1",
    "extract-text-webpack-plugin": "^3.0.2",
    "file-loader": "^0.11.1",
    "fs": "0.0.2",
    "global": "^4.3.2",
    "i18next": "^3.5.2",
    "immutable": "^3.8.2",
    "inline-environment-variables-webpack-plugin": "^1.2.1",
    "interact.js": "^1.2.6",
    "isomorphic-fetch": "^2.2.1",
    "js-file-download": "^0.4.1",
    "js-tree": "^1.1.0",
    "json-loader": "^0.5.4",
    "katex": "^0.6.0",
    "linkifyjs": "^2.1.5",
    "lodash": "^4.17.2",
    "material-ui": "^0.19.4",
    "material-ui-icons": "^1.0.0-beta.17",
    "material-ui-next": "^1.0.0-beta.20",
    "mathjs": "^3.16.4",
    "method-override": "^2.3.10",
    "mkdirp": "^0.5.1",
    "moment": "^2.17.0",
    "mongoose": "^4.12.1",
    "multer": "^1.1.0",
    "object-assign": "^4.1.0",
    "papaparse": "^4.3.6",
    "parse-katex": "^0.3.0",
    "passport": "^0.3.2",
    "passport-local": "^1.0.0",
    "passport.socketio": "^3.7.0",
    "postcss-cssnext": "^2.10.0",
    "postcss-import": "^9.0.0",
    "postcss-loader": "^1.3.3",
    "postcss-reporter": "^3.0.0",
    "postcss-simple-vars": "^3.0.0",
    "prop-types": "^15.6.0",
    "radium": "^0.19.6",
    "ramda": "^0.25.0",
    "react": "^16.2.0",
    "react-addons-update": "^15.6.2",
    "react-audio-player": "^0.6.2",
    "react-bootstrap": "^0.31.5",
    "react-bootstrap-table": "^4.0.0",
    "react-burger-menu": "^2.1.8",
    "react-color": "^2.13.8",
    "react-data-grid": "^2.0.60",
    "react-datetime": "^2.10.3",
    "react-dom": "^16.2.0",
    "react-dropzone": "^3.13.4",
    "react-emoji": "^0.4.4",
    "react-helmet": "^5.2.0",
    "react-i18next": "^6.1.0",
    "react-icons": "^2.2.7",
    "react-loader": "^2.4.0",
    "react-mixin": "^2.0.2",
    "react-pure-render": "^1.0.2",
    "react-redux": "^5.0.6",
    "react-router": "^3.2.0",
    "react-router-bootstrap": "^0.23.1",
    "react-router-redux": "^4.0.7",
    "react-select": "^1.0.0-rc.10",
    "react-sortable-hoc": "0.6.8",
    "react-stickydiv": "^3.4.20",
    "react-transform-hmr": "^1.0.4",
    "redux": "^3.6.0",
    "redux-burger-menu": "^0.2.2",
    "redux-logger": "^2.7.4",
    "redux-thunk": "^2.0.1",
    "rimraf": "^2.6.2",
    "serve-favicon": "^2.4.5",
    "socket.io": "^1.6.0",
    "socket.io-client": "^1.6.0",
    "style-loader": "^0.17.0",
    "unique-filename": "^1.1.0",
    "url-loader": "^0.5.8",
    "uuid": "^3.1.0",
    "webpack": "^3.8.1",
    "webpack-dev-middleware": "^1.12.0",
    "webpack-hot-middleware": "^2.19.1",
    "webpack-manifest-plugin": "^1.3.2",
    "winston": "^2.4.0",
    "xml2js": "^0.4.19"
  }

| Tech | Version |
|--------------|---------|
| Material-UI | 1.0.0 beta |
| React | 16.0 |
| browser | Chrome latest version |

Most helpful comment

Found a resolution by adding node_modules/material-ui-next/node_modules to webpack's resolve paths. This way webpack successfully finds and correctly includes [email protected] into dependency graph.

All 4 comments

When digging further, I noted that [email protected] has [email protected] as its peer dependency while [email protected] beta has [email protected] as its peer dependency. Furthermore, I suspect because I have both material-ui releases on my project, when importing a component from material-ui-next, the expected path for [email protected] from material-ui-next's perspective is project/node_modules but apparently due to having two versions of material-ui, the later installs [email protected] under material-ui-next as shown in the attached image.

image

Full stacktrace for the error:

image

Found a resolution by adding node_modules/material-ui-next/node_modules to webpack's resolve paths. This way webpack successfully finds and correctly includes [email protected] into dependency graph.

The best and the simplest solution, thanks @kevinguard

Was this page helpful?
0 / 5 - 0 ratings

Related issues

illogikal picture illogikal  路  75Comments

NonameSLdev picture NonameSLdev  路  56Comments

iceafish picture iceafish  路  62Comments

sjstebbins picture sjstebbins  路  71Comments

tdkn picture tdkn  路  57Comments