Closed Sawtaytoes closed 6 years ago
Check out koa-webpack
- that's a working implementation. Other than that, you can check out how webpack-serve
passes those properties. Happy to review a PR with some additional documentation as well.
I was actually looking into that, but I use Express. That example was similar to what I'm doing, but my code isn't working. I'll make another bug for that particular issue.
Well webpack-hot-client
isn't middleware, so it shouldn't depend on the server software you're using. If you're leveraging this module, then you're probably using webpack-dev-middleware
and that's the only middleware needed to get HMR working. Just pass the same compiler to them both.
I think I figured out the issue. https://stackoverflow.com/questions/51332490/unable-to-get-webpack-hot-client-to-reload-on-file-change/51332555#51332555
I needed to specify a custom port. Even though it was running on a host and port like localhost:64408
, this didn't work for some reason. Specifying the port directly, I was able to get it working.
The example had hotClient(webpackCompiler).server.on('listening', callback)
, but this is completely unnecessary.
Cool. Should we close this issue?
I still think the docs can use better explanation, but yes, the issue can be closed. The example in the docs isn't very helpful and, in my opinion, points someone in the wrong direction.
Happy to review a PR that adds to the documentation.
Documentation Is:
Please Explain in Detail...
I'd like to see more examples; possibly and actual working project, so I could replicate exactly what you've done. I've implemented the small example into my own project, but I haven't seen it work yet. It might be a timing issue where Express loads before
hotClient
and that's causing the.use
statement in.on('listening')
to not work properly. Either way, this isn't described in the docs. Even copy-pasting that example doesn't give any working code.Another example is the
server
prop. I don't know what this does. What if I already have a WebSocket instance running on that port? Will I still be able to use theserver
prop?Your Proposal for Changes
I think it'd be best to have a full example in there with the various options like passing in a
server
prop so we know what everything does and how to use it.