我在引入material-ui 的CDN版本时会出现react-transition-group/TransitionGroup未定义的问题。
material-ui 的UMD代码如下
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("./react"), require("./react-dom"), require("react-transition-group/TransitionGroup"));
else if(typeof define === 'function' && define.amd)
define("material-ui", ["react", "react-dom", "react-transition-group/TransitionGroup"], factory);
else if(typeof exports === 'object')
exports["material-ui"] = factory(require("./react"), require("./react-dom"), require("react-transition-group/TransitionGroup"));
else
root["material-ui"] = factory(root["React"], root["ReactDOM"], root["react-transition-group/TransitionGroup"]);
})(typeof self !== 'undefined' ? self : this
可以看到material-ui是依赖react-transition-group/TransitionGroup的,可是我不知道该怎么引入。
npm install react-transition-group --save