serverRenderer is not a functionSee original GitHub issue
node 8.9 webpack 4.12 webpack-hot-server-middleware 0.5.0
serverRenderer is not a function
- Created 5 years ago
- Comments:10 (2 by maintainers)
Top GitHub Comments
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.
in the webpack config for the server your entry point should be string:
You should change output.filename if your are using [name] computed property.