jcoreio / crater

Meteor/Webpack/React SSR app skeleton that runs your app code outside of Meteor Isobuild
ISC License
82 stars 10 forks source link

Webpack 2 branch isn't working right now #46

Closed evelant closed 7 years ago

evelant commented 7 years ago

There seem to be a few issues:

new webpack.LoaderOptionsPlugin({
    options: {
        postcss: [cssModulesValues]
    }
}),

After these changes it seems to run OK, but I am very new to webpack so there may still be other issues.

jedwards1211 commented 7 years ago

Thanks for letting me know! Do you want to make a PR?

evelant commented 7 years ago

It seems there are some issues with meteor-imports-webpack-plugin that are preventing webpack2 from working as well. https://github.com/luisherranz/meteor-imports-webpack-plugin/issues/13

I am still teaching myself webpack so these issues are difficult for me to solve at the moment. I am not sure when I will have time to dive in far enough to get a workable PR.

darkadept commented 7 years ago

As an alternative you can use Redux middleware to handle a lot of the Meteor reactivity. I adapted code from here https://github.com/djhi/my-nutrition/tree/master/app/client/middlewares for my own project.

If those middleware's are active you just fire a redux action like this:

function myAction(param1) {
  return {
    type: 'MY_ACTION',
    meteor: {
      subscribe: () => Meteor.subscribe('mysubscription', param1),
      get: () => MyCollection.find(),
    }
  }
}

The caveat here is that data is usually stored twice on the client side. Once in minimongo via Meteor, and then again when the reducer stores it in state. Not a big deal to me. Just ignore that minimongo exists. ;-)

jedwards1211 commented 7 years ago

It's funny how many ways there are to solve a problem. I have <MeteorSub> components that subscribe on mount or prop changes and unsubscribe on unmount so that I can declare what subscriptions I need for a given container. Really convenient for reactive joins on the client. Also, I created some redux integration for Mongo.Cursor.observeChanges that merges the document changes into my Immutable.js redux state. But it does get tricky to guarantee performance that way with thousands of documents.

jedwards1211 commented 7 years ago

Okay, this is fixed now