I am trying a hello world app using react-native, Meteor and xvonabur/ react-native-meteor
.
I am trying to subscribe to the data from MongoDB.
server code :
import {Mongo} from 'meteor/mongo';
import {Meteor} from 'meteor/meteor';
export const Pokemon = new Mongo.Collection('pokemon');
Meteor.publish('pokemon', () => {
return Pokemon.find({});
});
Client code:
export default createContainer(params=>{
Meteor.subscribe('pokemon');
return{
pokemon: Meteor.collection('pokemon').find({})
};
}, PokeMap);
As I understood after reading previous posts on stackoverflow, I have to define export const Pokemon = new Mongo.Collection('pokemon');
in a common scope to both server and the client. My client and the server are in Two different folders.
I tried to import pokemon.js
in to the client as follow,
import { Pokemon } from '../../pokeserver/imports/collections/pokemon.js'
and tried to use it as follow;
export default createContainer(params=>{
Meteor.subscribe('pokemon');
return{
pokemon: Pokemon.find({}),
};
}, PokeMap);
But I am getting following error,
undefined Unable to resolve module `../../pokeserver/imports/collections/pokemon.js` from `Src\PokeMap.js`: