Registry /
devops / browser-sync-v3-webpack-plugin
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
BrowserSyncPlugin
✓ const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
✗ import BrowsersyncPlugin from 'browser-sync-webpack-plugin';
Package is CommonJS only; default import does not work. Use require or ESM default interop.
new BrowserSyncPlugin()
✓ new BrowserSyncPlugin({host: 'localhost', port: 3000, server: {baseDir: ['./']}})
✗ new BrowserSyncPlugin();
Plugin requires at least an options object. If omitted, BrowserSync may fail to start.
PluginOptions
✓ const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
new BrowserSyncPlugin({proxy: 'http://localhost:8080'}, {reload: false})
✗ new BrowserSyncPlugin({proxy: 'http://localhost:8080', reload: false})
reload is a plugin option, not a BrowserSync option; must be in second argument object.
Basic setup: serves files from 'dist' directory with BrowserSync on localhost:3000 when webpack runs in watch mode.
const BrowserSyncPlugin = require('browser-sync-webpack-plugin');
const path = require('path');
module.exports = {
mode: 'development',
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'bundle.js',
},
watch: true,
plugins: [
new BrowserSyncPlugin({
host: 'localhost',
port: 3000,
server: { baseDir: ['dist'] },
}),
],
};
Errors
Common errors & fixes
Error: Cannot find module 'browser-sync-webpack-plugin'
Package not installed.
fixRun npm install --save-dev browser-sync-webpack-plugin
TypeError: BrowserSyncPlugin is not a constructor
Incorrect import style (e.g., using ES6 default import default).
fixUse const BrowserSyncPlugin = require('browser-sync-webpack-plugin'); Error: The 'mode' option has not been set, webpack will fallback to 'production' for this value.
Webpack v4+ requires mode to be set explicitly.
fixSet mode: 'development' in webpack config.
Error: connect ECONNREFUSED 127.0.0.1:3100
When using proxy option, Webpack Dev Server is not running on the expected port.
fixStart Webpack Dev Server first on the port you proxy (e.g., port 3100).
Audit
Dependencies
browser-syncrequiredPeer dependency: required to run BrowserSync server
webpackrequiredPeer dependency: Webpack plugin