Webpack compiler inside Meteor (ES6 modules, hot reload and code splitting!)

I have no idea (-;
Now I’m using pre-pre-version of kickstart with flow-router - without any problem…but now - I’m not sure )-;

Update: tried to add flow-router - now I do not know where to place routes, sad
There is no route for the path: /

1 Like

Yes it is. You can use kickstart-simple, get rid of reactrouter:react-router-ssr, remove it from entry/server/entry.js, entry/client/routes.jsx and modules/TodoApp/client/routes.jsx. Then you can add your FlowRouter call.

1 Like

Presumably, it should also be removed from module.exports in webpack.conf.js too?

Also, where to add the FlowRouter call?

1 Like

Good question… I tried in entry/client/routes.js, modules/TodoApp/client/routes.js, entry/client/lib/routes.js - without success

me too.

I’m missing something in my understanding of the entry logic.

Whatever I do results in There is no route for the path: /

1 Like

I have the same… no route to /

I think FlowRouter.initialize() might be needed in order for Flow Routing to work in this app structure. Is that right @SkinnyGeek1010? I remember you had to do this in one of your examples.

If I add this, then
There is no route for the path: /
Uncaught Error: FlowRouter is already initialized

You might need to do FlowRouter.wait() first.

I did (-:
In entry/client/lib/routes.js. After that in entry/client/routes.js

Yes, but where to put that.

In this structure `entry/client/entry,js’ is the earliest required file, but at this point FlowRouter is already initialised…

Oh, I don’t know then, might need to wait for @SkinnyGeek1010 because he had some example in Github, but I don’t know where it is.

The structure that @benoitt has used is a little different from that used by @jedwards where @SkinnyGeek1010 used Flow-Router… I found those examples where the solution was to use .wait() and then .initialise() but that method, seemingly, doesn’t transfer…

I always use react-router because it is so awesome but I think I’ll make a kickstart-flowrouter. A few Meteor fans might want this :wink:

2 Likes

I bet it will work in production but not in development. This is because the script in development is not bundled with Meteor but on a different server.

Maybe I should have a special folder that would allow you to add code to Meteor and bypassing Webpack. Or maybe I can add a special case inside the webpack compiler if you’re using the FlowRouter. Is there a lot of libraries that need to execute code before the package is loaded on the DOM?

Yes-yes-yes! (((-:
For me, react-router is not so clear, in comparison with the flow-/iron-router )-:

'spose the issue access to Meteor’s startup callback.

A shim to ensure we can put code into the first loaded startup would probably be sufficient in this case, and widely applicable to others.

Yea here’s the guide for Jedwards’ setup:

The wait has to be placed in the lib of the meteor files, not in the webpack code.

That’s right, but in this setup even including the .wait() method in lib/ is still after flowRouter has been initialized.

And you can’t put it in a Meteor.startup() because it’s too late, we’ve missed the startup queue.

Yes, it also happen with useraccounts:core for example. AccountsTemplates.configure(...) gets rejected because it “must be set before AccountsTemplates.init”.