Creating SPA with webpack and babel issues


I’m trying to combine the SPA lesson from the Learning React Book with the last chapter about setting up your development environment, but I keep running into issues rendering any of my components. I thought it might have to do with setting up react-router in package.json, but I honestly don’t know what’s wrong.

I don’t get any error messages when I run the webpack command, but I still don’t have any components visible.


Do you see any errors in the console when you preview your HTML page?


Yes, I get this error:

Uncaught TypeError: Cannot read property ‘Router’ of undefined
at Object. (myCode.js:10858)
at webpack_require (myCode.js:20)
at module.exports (myCode.js:63)
at myCode.js:66


It does seem like a react router issue. Are you able to build the simple hello world app without any issue? :slight_smile:


Yeah, I was able to complete everything in the book with no issues, but I’m trying to run the SPA project with the development environment from the last chapter.