
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
webpack-dev-server
Advanced tools
webpack-dev-server is a development server that provides live reloading. It is intended to be used with webpack, a module bundler. It uses webpack's watch mode and, when changes are detected, it recompiles the bundle and notifies the client to reload the page.
Live Reloading
Automatically reloads the page when files are changed. The 'hot' option enables Hot Module Replacement without page refresh as fallback in case of build failures.
module.exports = {
devServer: {
contentBase: './dist',
hot: true
}
};
Custom Middleware
Allows developers to add custom routes before the server starts. Useful for mocking an API or other custom server logic.
module.exports = {
devServer: {
before: function(app, server) {
app.get('/some/path', function(req, res) {
res.json({ custom: 'response' });
});
}
}
};
Proxying API Requests
Redirects API calls to another server. This is useful when you have a separate API backend development server and you want to send API requests on the same domain.
module.exports = {
devServer: {
proxy: {
'/api': 'http://localhost:3000'
}
}
};
HTTPS Support
Allows serving the webpack application over HTTPS. This is useful for testing applications that require secure connections.
module.exports = {
devServer: {
https: true
}
};
BrowserSync is an automation tool that makes web development faster. It synchronizes file changes and interactions across multiple devices. It's similar to webpack-dev-server but works across multiple browsers and devices.
Lite-server is a lightweight development server that serves a web app, opens it in the browser, and refreshes the browser on file changes. It is built on top of BrowserSync and provides fewer configuration options compared to webpack-dev-server.
Serve is a static server that lets you serve static files quickly. It is simpler than webpack-dev-server and does not have built-in support for live reloading or module bundling.
http-server is a simple, zero-configuration command-line HTTP server. It is powerful and has the ability to serve static files, but lacks the advanced features of webpack-dev-server like live reloading and module hot replacement.
THIS SERVER SHOULD ONLY USED FOR DEVELOPMENT!
DO NOT USE IT IN PRODUCTION!
It's a little server using webpack-dev-middleware to serve a webpack app.
It also uses socket.io to update the browser if the bundle has changed (and to display compilation errors).
You need to pass a web app entry point, and you can also pass a html page to display and webpack options.
This project is heavily inspirated by peerigon/nof5.
webpack-dev-server <webpack entry point>
Options:
--content-page A html page to load [string]
--content-url A url to load [string]
--options webpack options [string]
--port The port [number]
var Server = require("webpack-dev-server");
var options = {
content: absoluteFilenameToContentHtmlPage,
// Content page to display
// it will default to a simple page
contentUrl: "http://...",
// if set it will load this URL as content page
// it will default to undefined
middleware: {
// webpack-dev-middleware options
},
webpack: {
// webpack options
// ...
watch: true // recommended
/* defaults:
output: "bundle.js",
debug: true,
filenames: true,
watch: true
*/
}
};
new Server(entryPoint, options).listen(port[, host]);
entryPoint should be an absolute path. It may be prefixed with loaders.
The client scripts are build with npm run-script postinstall
.
Copyright 2012 Tobias Koppers
FAQs
Serves a webpack app. Updates the browser on changes.
The npm package webpack-dev-server receives a total of 14,478,882 weekly downloads. As such, webpack-dev-server popularity was classified as popular.
We found that webpack-dev-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.