mhaagens / react-mobx-react-router4-boilerplate

React, React-Router 4, MobX and Webpack 2-boilerplate with async routes.
560 stars 137 forks source link

Invariant Violation in Chrome and (all) #17

Closed hillscottc closed 7 years ago

hillscottc commented 7 years ago

I am getting the Invariant Violation in

Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Check the render method of `App`.

I think the problem is in the dependencies that are specified imprecisely or really bleeding-edge. Specifically, these:

 "devDependencies": {
   "extract-text-webpack-plugin": "^2.0.0-beta.4",
    "webpack": "beta",
    "webpack-dev-server": "^2.1.0-beta.8"
  },
  "dependencies": {
    "react-router": "next",
    "webpack-dev-server": "beta",
  }

Yarn complains that:

"dependencies" has dependency "webpack-dev-server" with range "beta" that collides with a dependency in "devDependencies" of the same name with version "^2.1.0-beta.8"

webpack and webpack-dev-server have a solid 2.2.0 release. Specifying it as just beta could be problematic. And react:router:next seems shaky too.

Trying to tweak these, then rm -rf node_modules && yarn, seems to have given me the broken build. The deps, as they are, seem a little brittle. I'm playing with it to see if I can make a more definitive suggestion.

hillscottc commented 7 years ago

Hmm. Looks like the multiple Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class... are being thrown by the LazyRoutes being passed to the router.

You know, what I like the best about this boilerplate is the clean webpack 2 config with React + Mobx. I am less enthusiastic about a new take on react-routing, if that is what's tricky.

mhaagens commented 7 years ago

Try pulling now, I've updated to the latest React Router 4 beta, I didn't lock the version which may have caused some problems because of changes in the new React Router 4 Beta API. This boilerplate has a lot of "bleeding edge" stuff, so sadly sometimes things will break due to API changes, but I'll do my best to keep fixing things once that happens.

mhaagens commented 7 years ago

Did the update work for you @hillscottc ?