I am puzzled why the following doesn't work
GroupList.js
export default Relay.createContainer(List, {
...
})
which transpiled to:
exports.List = List;
exports['default'] = _reactRelay2['default'].createContainer(List, {
}
});
importing it as following DOESN'T WORK
import GroupList from './GroupList';
or
import {default as GroupList} from './GroupList';
but the following works
export const GroupList = Relay.createContainer(List, {
..
});
which transpiled to:
exports.List = List;
var GroupList = _reactRelay2['default'].createContainer(List, {
...
});
exports.GroupList = GroupList;
and importing this like in another module like this WORKS.
import {GroupList} from './GroupList';
so, what is the difference? That is, How to import it another file if I use the form
export default Relay.createContainer(List, {
Edit: addl info as requested by @bergi
working
transpiled import:
var _GroupList = __webpack_require__(324);
webpack module:
/***/ },
/* 324 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {'use strict';
...
var GroupList = (0, _redux.compose)((0, _utilsRelay2['default'])({
...
}))(List);
exports.GroupList = GroupList;
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(34)(module)))
/***/ },
/* 325 */
Not working:
transpiled import:
var _GroupList = __webpack_require__(324);
webpack module:
/***/ },
/* 324 */
/***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module) {'use strict';
...
exports.List = List;
exports['default'] = (0, _redux.compose)(
...
}))(List);
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(34)(module)))
/***/ },
/* 325 */
Error:
Uncaught Error: Invariant Violation: Element type is invalid: expected a string (for built-in components)
or a class/function (for composite components) but got: undefined. Check the render method of `GroupContainer`.
invariant @ invariant.js:39
instantiateReactComponent @ instantiateReactComponent.js:64
instantiateChild @ ReactChildReconciler.js:29traverseAllChildrenImpl @ traverseAllChildren.js:98
traverseAllChildren @ traverseAllChildren.js:186
ReactChildReconciler.instantiateChildren @ ReactChildReconciler.js:52
ReactMultiChild.Mixin._reconcilerInstantiateChildren @ ReactMultiChild.js:197