paypal / react-engine

a composite render engine for universal (isomorphic) express apps to render both plain react views and react-router views
Apache License 2.0
1.45k stars 130 forks source link

Please update the examples (Specifically the Webpack example...) #107

Closed YarivGilad closed 8 years ago

YarivGilad commented 8 years ago

Examples are the first place someone new to your library will go to. If we download & install the examples and it blows up - what are we to do? We're new to the library so we cannot really debug it... looks like you need to update react version, get rid of jsx-loader and use babel-loader instead for starters but when it comes to errors like these, it seems like a dead-end...

TypeError: Router.create is not a function at ReactEngineView.render (/Users/Ajar/Downloads/react-engine-master/examples/webpack/node_modules/react-engine/lib/server.js:111:29)

samsel commented 8 years ago

@Ajar-Ajar totally understandable. I've updated the examples in master branch. let me know if you are still facing issues.

YarivGilad commented 8 years ago

Hi @samsel Thank you for the quick response. I'm afraid react in the example is still version 13.3 please try installing the latest - 14.0 react-router version is 0.13.4 the latest is - 1.0.0-rc3 - you need to use the following line to install it npm install history react-router@latest - it needs to be installed along with the history package according to their latest installation instructions last - you need to switch from jsx-loader to babel also in the webpack.config.js and write: { test: /.jsx$/, exclude: /node_modules/, loaders: ["babel-loader"] },

instead of: { test: /.jsx$/, loader: 'jsx-loader?insertPragma=React.DOM&harmony' },

After you make these changes - try to run the example and see what I'm talking about... First off - while running 'npm start' you will get the following ERROR in the console: ERROR in Cannot find module 'object-assign' @ ./public/index.js 18:13-36

Second - while trying to access example app on localhost:3000 you will get:

TypeError: Router.create is not a function at ReactEngineView.render (/Users/Ajar/Downloads/react-engine-master 2/examples/webpack/node_modules/react-engine/lib/server.js:111:29) at ReactEngineView.render (/Users/Ajar/Downloads/react-engine-master 2/examples/webpack/node_modules/react-engine/lib/expressView.js:51:10) at tryRender (/Users/Ajar/Downloads/react-engine-master 2/examples/webpack/node_modules/express/lib/application.js:639:10) at EventEmitter.render (/Users/Ajar/Downloads/react-engine-master 2/examples/webpack/node_modules/express/lib/application.js:591:3) at ServerResponse.render (/Users/Ajar/Downloads/react-engine-master 2/examples/webpack/node_modules/express/lib/response.js:961:7) at /Users/Ajar/Downloads/react-engine-master 2/examples/webpack/index.js:49:7 at Layer.handle [as handle_request](/Users/Ajar/Downloads/react-engine-master 2/examples/webpack/node_modules/express/lib/router/layer.js:95:5) at next (/Users/Ajar/Downloads/react-engine-master 2/examples/webpack/node_modules/express/lib/router/route.js:131:13) at Route.dispatch (/Users/Ajar/Downloads/react-engine-master 2/examples/webpack/node_modules/express/lib/router/route.js:112:3) at Layer.handle [as handle_request](/Users/Ajar/Downloads/react-engine-master 2/examples/webpack/node_modules/express/lib/router/layer.js:95:5)

Thank you for taking care of that. Ajar

samsel commented 8 years ago

@Ajar-Ajar we don't support react-router 1.x yet. we have 3.0.0-alpha.1 version of react-engine if you are interested in using react-engine with react-router 1.x

samsel commented 8 years ago

I would take replacing jsx-loader with babel-loader as an enhancement as it doesn't block anyone from running examples and would address it as we revamp the examples. let me know otherwise

YarivGilad commented 8 years ago

Hi @samsel Is it possible to use react-engine with react 14? I'm not sure if react 14 forces you to use react-router 1 or you can use react-router 13.x... regarding jsx-loader & babel-loader - it isn't that important, you're right...

samsel commented 8 years ago

@Ajar-Ajar I think its the other way around. react-router 1.x supports only react 0.14

samsel commented 8 years ago

@Ajar-Ajar Please checkout the updated example.

Also,

react-engine version 3.0.0-rc.2 is published

It has support for react@0.14 and react-router@1.

You can follow the v3.x README to upgrade. A more precise migration note can be found here.

Please file issues or comment here if you face any difficulties. We are planning to publish 3.x towards the end of next week.