crater
crater copied to clipboard
Does not work with react-meteor-data
Add react-meteor-data plugin to meteor and react-addons-pure-render-mixing to package.json and the following happens on the client if you try to import from meteor/react-meteor-data:
WARNING: npm peer requirements (for react-meteor-data) not installed:
- [email protected] not installed.
- [email protected] not installed.
Read more about installing npm peer dependencies:
http://guide.meteor.com/using-packages.html#peer-npm-dependencies
modules-runtime.js:128 Uncaught Error: Cannot find module 'react'
require.resolve @ modules-runtime.js:128
Module.resolve @ modules-runtime.js:84
Mp.import @ modules.js:282
meteorInstall.node_modules.meteor.react-meteor-data.createContainer.jsx @ react-meteor-data.js:243
fileEvaluate @ modules-runtime.js:180
require @ modules-runtime.js:109
meteorInstall.node_modules.meteor.react-meteor-data.react-meteor-data.jsx @ react-meteor-data.js:45
fileEvaluate @ modules-runtime.js:180
require @ modules-runtime.js:109
(anonymous function) @ react-meteor-data.js:299
(anonymous function) @ react-meteor-data.js:310
(anonymous function) @ app.js:2098
__webpack_require__ @ app.js:556
fn @ app.js:87
webpackContext @ packages_nonrecursive_\.js$:33
(anonymous function) @ meteor-imports.js:18
(anonymous function) @ meteor-imports.js:16
(anonymous function) @ app.js:3178
__webpack_require__ @ app.js:556
fn @ app.js:87
(anonymous function) @ index.js:3
(anonymous function) @ app.js:2524
__webpack_require__ @ app.js:556
fn @ app.js:87
(anonymous function) @ multi_main:1
(anonymous function) @ app.js:586
__webpack_require__ @ app.js:556
(anonymous function) @ app.js:579
(anonymous function) @ app.js:582
Looks like meteor packages can't resolve npm packages. I'm not sure how to fix this.
It's happening because Isobuild transpiles import
statements into stuff that's not webpack-compatible. I don't approve of much of anything isobuild does.
You would be able to npm install --save meteor/react-packages#[email protected]
except that react-packages
doesn't provide a version
in its package.json
. One option is to clone the react-meteor-data
package using git subtree
and import from that folder instead. I'll try to get them to add a proper version to package.json
...
See https://github.com/meteor/react-packages/pull/201
I might be able to figure out a way to de-transpile isobuild's module statements though...
As an easy workaround I just copied the code for react-meteor-data from here https://github.com/meteor/react-packages/tree/devel/packages/react-meteor-data into my project since it is quite simple. It builds fine under webpack with the meteor-imports-webpack-plugin.
@fignuts yeah that works too. I only suggested using git subtree
because you'd be able to pull updates from their repo.
I was almost tempted to preemptively start publishing a react-meteor-data
npm package 😸
@fignuts okay, I created a react-meteor-data
npm package. Now you should just be able to npm i --save react-meteor-data react-addons-pure-render-mixin
:)
Awesome! Thanks!
When I do
npm install --save-dev react-meteor-data react-addons-pure-render-mixin
I get
ReferenceError: Tracker is not defined MeteorDataManager.calculateData webpack:///./~/react-meteor-data/lib/ReactMeteorData.js?:93:26
@java99
I had to add var { Tracker } = Package.tracker
at the top of node_modules/react-meteor-data/lib/ReactMeteorData.js
. This is a hacky fix. Hopefully the NPM package could be republished to include this dependency or we could find some alternative solution.
@kawikadkekahuna I just published a fix for that, could you install the latest version of react-meteor-data
(0.2.10) and let me know how it works?
@jedwards1211
Awesome. Fixed now. Thanks for updating it.
@kawikadkekahuna you're welcome!