When to use "devServer.injectClient" in Webpack config?

Viewed 531

I am working on a project that involves elaborated Webpack config generator. Recently the liveReload stopped working. File watcher works fine though.

Upon inspected the built bundle, I found out that the live reload client was not injected to the bundle.

Digging into Webpack 4 document I saw this flag: https://webpack.js.org/configuration/dev-server/#devserverinjectclient devServer.injectClient which is default to false. Setting that to true solves the issue.

But I am wondering why is it default to false? As the default Webpack config "should just work". So by setting "devServer.liveReload = true" should make everything working.

Hence my questions:

What are the situations I need to set "injectClient = true". Why do we need to have this flag in the first place?

0 Answers
Related