From the course: Learning webpack 4
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Using the webpack-dev-server
From the course: Learning webpack 4
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.