mystor / meteor-routecore

Client and server side rendering/routing powered by React
84 stars 6 forks source link

Don't embed react 0.8.0 in the bundle, use the react-meteor install instead? #8

Closed mathieutozer closed 10 years ago

mathieutozer commented 10 years ago

https://github.com/reactjs/react-meteor

I can use react with react-bootstrap here, but as soon as I add routecore things break.

/Users/mtozer/.meteor/tools/c2a0453c51/lib/nodemodules/fibers/future.js:173 throw(ex); ^ TypeError: Cannot read property 'name' of undefined at /Users/mtozer/.meteor/tools/c2a0453c51/tools/packages.js:750:28 at Function..each._.forEach (/Users/mtozer/.meteor/tools/c2a0453c51/lib/nodemodules/underscore/underscore.js:87:22) at /Users/mtozer/.meteor/tools/c2a0453c51/tools/packages.js:745:9 at Array.forEach (native) at Function..each._.forEach (/Users/mtozer/.meteor/tools/c2a0453c51/lib/nodemodules/underscore/underscore.js:79:11) at .extend.allHandlers (/Users/mtozer/.meteor/tools/c2a0453c51/tools/packages.js:744:7) at .extend.registeredExtensions (/Users/mtozer/.meteor/tools/c2a0453c51/tools/packages.js:768:24) at slice.getSourcesFunc (/Users/mtozer/.meteor/tools/c2a0453c51/tools/packages.js:1713:41) at .extend.build (/Users/mtozer/.meteor/tools/c2a0453c51/tools/packages.js:279:17) at /Users/mtozer/.meteor/tools/c2a0453c51/tools/packages.js:1088:13 at Array.forEach (native) at Function..each._.forEach (/Users/mtozer/.meteor/tools/c2a0453c51/lib/nodemodules/underscore/underscore.js:79:11) at .extend.build (/Users/mtozer/.meteor/tools/c2a0453c51/tools/packages.js:1087:7) at .extend.getForApp (/Users/mtozer/.meteor/tools/c2a0453c51/tools/library.js:285:9) at /Users/mtozer/.meteor/tools/c2a0453c51/tools/bundler.js:1762:25 at Object.capture (/Users/mtozer/.meteor/tools/c2a0453c51/tools/buildmessage.js:191:5) at Object.exports.bundle (/Users/mtozer/.meteor/tools/c2a0453c51/tools/bundler.js:1697:31) at .extend.runOnce (/Users/mtozer/.meteor/tools/c2a0453c51/tools/run-app.js:396:32) at .extend._fiber (/Users/mtozer/.meteor/tools/c2a0453c51/tools/run-app.js:520:28) at /Users/mtozer/.meteor/tools/c2a0453c51/tools/run-app.js:340:12

I tried removing it myself but couldn't work out the best way...

mystor commented 10 years ago

react-meteor includes, in addition to the basic react bundle, a few extra helpers which are designed to help you integrate Meteor and React. These helpers are unnecessary within the context of routecore, as they are all replaced by routecore functionality. In the interest of simplifying the API and reducing code sent to the client (however minorly), it makes more sense to directly bundle react in routecore rather than delegating to another meteor plugin.

If there is a compelling reason why using react-meteor is superior to directly using react, I would be glad to hear it, however I feel as though packaging it directly makes the most sense in this situation.

mathieutozer commented 10 years ago

Sounds reasonable (again I am completely new to web development). Do you know what might be causing that error then?

mystor commented 10 years ago

The error appears to be because both routecore and meteor-react try to handle the .jsx extension and compile it using react-tools.

Normally this would produce a more meaningful error message, but for some reason one of the package objects during Meteor's compile stage is undefined (not sure why).

mathieutozer commented 10 years ago

Huh ok - so any idea how to resolve this? If there are react issues to prioritize I sit next to the people who wrote it :)

mathieutozer commented 10 years ago

It turns out that there aren't any jsx files in the latest, so I just removed

// Package._transitional_registerBuildPlugin({ // name: 'compileJSX', // use: [], // sources: [ // 'plugin/compile-jsx.js' // ], // npmDependencies: { // 'react-tools': '0.8.0' // } // });

And it works.

mystor commented 10 years ago

That makes sense. Both plugins were providing the extension, as they are designed to, for the most part, fill the same role in the program. I would not recommend having both routecore and react-meteor in the same meteor app as that means you will have two copies of react loaded on the webpage.