In Adam’s version I have no idea, how replace react-router to flow-router. And all logic in index.js…Is it possible without index.jsx, but with flow-router in lib folder in Meteor app??
Or is it impossible?
Or is it webpack restrictions?
Honestly, my ideal workflow is having everything inside the Meteor folder. But with Webpack, it’s just impossible because everytime you change a file, the Meteor server will restart and it would make the hot-reload with no browser refresh impossible. It’s the only reason.
It is actually using Meteor stuff inside the React folder. It has access to everything you normally would have access on the client.
If I could get hot module replacement (HMR) inside the Meteor isobuild, we could drop webpack and have everything inside Meteor. It would be really nice, but it is a lot of work
Benoit, for me, honestly, your version is a little bit easier for understanding (-:
And no problem with react folder outside meteor folder.
Is it possible to make the app without your App.jsx and index.jsx, but with flow-routes inside meteor/lib folder? Honestly, I got used to iron-router and flow-router, and prefer make some checks in onBeforeAction or triggersEnter…
Yep! I’m actually using FlowRouter in one of my apps too. It’s a bit tricky when using in Webpack because it’s loaded a bit late. However, there is a wait method you can call when all of your routes are defined:
You could also put it in meteor_core if that’s wanted.
It doesn’t matter in what files they are. If you are using react-router, you can have only a single root route and use childRoutes that are imported from other files. If you’re using FlowRouter, you could probably put it anywhere.
And, thanks to Adam, I’ve added /meteor/client/lib/routes.js with FlowRouter.wait();
And, of cause, FlowRouter.initialize(); in index.jsx.
Then I tried to register routes in different files - did not work.
I know, I’m doing something wrong, but can’t understand what…
I think, I need some more experiments…but even if I have to write all the routes in a one file, it’s not such a big price for convenience (-: