christianalfoni / webpack-example

An example of webpack workflow
78 stars 9 forks source link

react-router #3

Closed pitu7dg closed 9 years ago

pitu7dg commented 9 years ago

It works fine, but I wanted to route with react-router. Why after adding only variable everything crashes? Only this line.

var Router = require('react-router');
ERROR in ./~/react-router/lib/components/Link.js
Module not found: Error: Cannot resolve 'file' or 'directory' /home/piotr/Deskto
p/www/webpack-example/bower_components/react/react.min.js/lib/Object.assign in /
home/piotr/Desktop/www/webpack-example/node_modules/react-router/lib/components
 @ ./~/react-router/lib/components/Link.js 10:13-47

react-router / webpack / webpack-dev-server

christianalfoni commented 9 years ago

Hi @pitu7dg ,

Some time has passed since I wrote that article and created the repo. Also Webpack has been released in new versions. I would suggest you head over here: http://www.christianalfoni.com/articles/2015_04_19_The-ultimate-webpack-setup and use that approach instead, it uses this repo: https://github.com/christianalfoni/webpack-express-boilerplate. It gives a "stronger setup" and makes it easier for you to add new dependencies like react-router.

I will update this repo with the same information.

pitu7dg commented 9 years ago

I found solution for my problem. I needed to add this to package.json

  "browser": {
    "react-router": "./bower_components/react-router/build/umd/ReactRouter.min.js"
  },