From the course: Learning webpack 4

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using the webpack-dev-server

Using the webpack-dev-server

From the course: Learning webpack 4

Start my 1-month free trial

Using the webpack-dev-server

- [Narrator] Another nice feature of webpack is that it allows you to set up a development server that will automatically reload your project when things change. Webpack dev server uses a node JS express server. This uses the webpack dev middleware to serve a webpack bundle. It opens up a socket using Socket IO that listens for any changes. The webpack dev server is an important tool to have at your disposal when working with webpack. When you include it in your project, it'll allow for the live reloading of all of your assets. Let's first start by installing it. We're going to install webpack dev server. Now once this is installed, we can go back over to our webpack config and we're going to add another node here called devServer. I usually like to add it here above all these loaders, so I can remember that it's here. We'll also add a contentBase path dot join, so underscore, underscore, dirname, and dist, and then we want to describe which port that should run on, so typically the…

Contents