question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

serverRenderer is not a function

See original GitHub issue

environment :

node 8.9
webpack 4.12
webpack-hot-server-middleware  0.5.0

error

serverRenderer is not a function

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
threehamscommented, Jul 1, 2018

Both react-universal-component and webpack-hot-server-middleware can work with Webpack 4. However, this issue can get in the way: https://github.com/webpack/webpack/issues/7516

The “serverRenderer is not a function” error happens most often because the real error is swallowed on one of these two lines: https://github.com/60frames/webpack-hot-server-middleware/blob/master/src/index.js#L152-L153

In the case of async code splitting - any code splitting, not just react-universal-component - that Webpack issue can leave you with a chunk name based off an async chunk rather than your entry point. So, with an entry name of “server” and an import() of “Home” will sometimes cause LimitChunkCountPlugin to use the output + chunk name “Home” instead of “server,” which leaves webapck-hot-server-middleware unable to find the default/configured chunk name + file of “server.”

I’m attempting to put together a PR to provide friendly error reporting when something fails on these two lines. Took me the better part of an hour to figure out what was going on here.

0reactions
yilmazbingocommented, Mar 23, 2020

in the webpack config for the server your entry point should be string:

entry: "./src/server/render.js",

You should change output.filename if your are using [name] computed property.

Read more comments on GitHub >

github_iconTop Results From Across the Web

type error: server render is no a function - Stack Overflow
serverRender() doesn't return Promise . You can try to the callback based approach. const serverRender = (callback) ...
Read more >
Server-Side Rendering API - Vue.js
This method is not supported in the ESM build of vue/server-renderer , which is decoupled from Node.js environments. Use pipeToNodeWritable instead.
Read more >
vue-server-renderer | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >
Server-side Rendering - Yew
Yew provides a ServerRenderer to render pages on the server-side. ... rendering support, prefer function components unless you have a good reason not...
Read more >
TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found