CrocoDillon / universal-react-redux-boilerplate

Step by step creation of a Universal React + Redux Boilerplate
Other
176 stars 33 forks source link

No client-side rendering #12

Closed stepanh closed 7 years ago

stepanh commented 8 years ago

You say 'client-side rendering is an enhancement', but I think I'm not the only one who would appreciate it to be enabled by default.

Right now, clicking through blog, every page gets server re-rendered.

Keep up the good work ;-)

CrocoDillon commented 8 years ago

enabled by default

It should be, of course! :astonished: I'll take a look tonight. What platform are you on?

stepanh commented 8 years ago

cheers :-)

macOS, Node 6.5.0, Chrome

CrocoDillon commented 8 years ago

Works for me, on Ubuntu though with Node 6.2.1. Can you try the v2 branch? It's basically same as master minus the Windows compatibility fixes.

I tried both development and production modes, client side rendering worked on both. There is some network activity when navigating trough the “blog” but those are just data fetches.

CrocoDillon commented 8 years ago

I'll re-open this when I get more information to work from :)

jonaswindey commented 7 years ago

I have the same issue

Running locally gives a first 404 error in console on GET http://localhost:3000/app.js 404 (Not Found)

However, once the page is loaded, I can access http://localhost:3000/app.js and see the full script.

Chrome on macOS, node v6.3.1

jonaswindey commented 7 years ago

Extra info:

CrocoDillon commented 7 years ago

Thanks for the details!

Not sure those issues are related but it's something I should look at either way. The deprecation warning is easy to fix, just remove the .development(...) line. It relies on NODE_ENV already anyway.

Could you try that and see if it solves the client-side script issues too? Otherwise I will take a look in the weekend.

jonaswindey commented 7 years ago

I've removed the .development line in /bin/server but the problem is still there.

What's strange is that in my chrome I get GET http://localhost:3000/app.js 404 (Not Found), but once the page is loaded the same get works correctly.

CrocoDillon commented 7 years ago

I found out the issue is related to changes in webpack-dev-middleware 1.8.0... my bad probably, since it's not made for Koa.

While I figure out how to make it work again with Koa I suggest:

"webpack-dev-middleware": "1.7.0"
CrocoDillon commented 7 years ago

By the way, this is somewhat related (it will fix the root cause of this issue, which is the workaround needed to make Webpack dev middleware work with Koa) and might be an interesting thread to follow - webpack/webpack-dev-middleware#111

Truji92 commented 7 years ago

The problem seems to be that the middleware serves the bundle correctly but with a 404 status code. I "fixed" it in webpack.server.js adding:

if (mockResponse) { res.statusCode = 200 }

here is the full file https://gist.github.com/Truji92/1e598ceab3c967d2dbed140ec739483d

Maybe is a ugly fix, but it's working... haha

CrocoDillon commented 7 years ago

I pinned webpack-dev-middleware to1.7.0 on master for now, so closing this issue. Need more time to look into the real issue anyway 😁