LiveReload plugin for Webpack that triggers browser reloads when assets change during `webpack --watch`. Current stable version is 3.0.2, actively maintained. It differs from webpack-dev-server by being designed for cases where assets are served by an external app server (e.g., a backend framework) while still benefiting from LiveReload. Uses tiny-lr under the hood. Supports HTTPS, custom ports/hostnames, optional script injection, file ignoring, delay, and source hash/size change detection to avoid duplicate reloads. Works with both Webpack 4 and 5.
npm install webpack-livereload-pluginVerified import paths — ran on the pinned version, not inferred.
Minimal webpack config adding LiveReloadPlugin with automatic script injection, then run webpack --watch to trigger reloads on file changes.
Set useSourceHash: true or useSourceSize: true instead of liveCSS: false and liveImg: false.
Specify a fixed port number, or use the 'port' event on the plugin to retrieve the actual port.
Manually add the script tag: <script src='//localhost:35729/livereload.js'></script>.
Use useSourceHash instead, which compares file hash rather than size.
Run 'npm install --save-dev webpack-livereload-plugin' in your project.
Use: const LiveReloadPlugin = require('webpack-livereload-plugin'); or import LiveReloadPlugin from 'webpack-livereload-plugin';Specify a different port in the options, e.g., new LiveReloadPlugin({ port: 35730 }).