Registry / devops / webpack-open-browser

webpack-open-browser

JSON →
library2.0.2jsnpmunverified

Webpack plugin to automatically open a browser when webpack's dev server starts. Current stable version is 2.0.2, supports webpack >=4.0.0 <6.0.0. Uses the 'open' package for cross-platform browser launching, including incognito mode via arguments. Differentiators: supports multiple URLs/browsers via array config, delay option, ignore errors option, and includes built-in cross-platform browser name constants for Chrome, Firefox, and Edge. The package ships TypeScript types.

npm install webpack-open-browser
INSTALL
IMPORT
SIG · WEBPACK-OPEN-BROWS
W
webpack-open-browser
devopsjavascriptv2.0.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

WebpackOpenBrowser
import { WebpackOpenBrowser } from 'webpack-open-browser'
import WebpackOpenBrowser from 'webpack-open-browser'
Named export, not default. In CJS use const { WebpackOpenBrowser } = require('webpack-open-browser'). Since v2.0.0 ESM is supported.
apps
import { apps } from 'webpack-open-browser'
const apps = require('webpack-open-browser').apps
the apps object is a named export containing browser constants like apps.chrome, apps.firefox, apps.edge.
type WebpackOpenBrowserOptions
import type { WebpackOpenBrowserOptions } from 'webpack-open-browser'
TypeScript type export available since v2.0.0. Use for type-checking options.

Demonstrates the minimal setup: import the plugin and add it to the plugins array with a URL.

// webpack.config.js const { WebpackOpenBrowser } = require('webpack-open-browser'); module.exports = { plugins: [ new WebpackOpenBrowser({ url: 'http://localhost:3000' }), ], };
Debug
Known issues
breakingIn v2.0.0, the import path changed from default export to named export. If still using 'const WebpackOpenBrowser = require('webpack-open-browser').default' it will break.
fix
Use const { WebpackOpenBrowser } = require('webpack-open-browser') or import { WebpackOpenBrowser } from 'webpack-open-browser'.
affects: <2.0.0
gotchaThe browser option is platform-dependent. Using 'chrome' on MacOS won't work; use 'Google Chrome' or apps.chrome instead.
fix
Use apps.chrome (cross-platform) or the full application name for your OS (e.g., 'Google Chrome' on Mac, 'chrome' on Windows).
affects: >=1.0.0
gotchaThe plugin only works by default when there are no compilation errors. If errors exist, the browser won't open.
fix
Set the option ignoreErrors: true to open the browser even if there are compilation errors.
affects: >=1.0.0
deprecatedPassing plugins as array elements with new keyword for each option group is the only supported syntax. There is no deprecated usage.
fix
N/A
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'webpack-open-browser'
Package not installed or not in node_modules.
fix
Run npm install webpack-open-browser --save-dev.
TypeError: WebpackOpenBrowser is not a constructor
Using a default import when the package only exports named exports.
fix
Use const { WebpackOpenBrowser } = require('webpack-open-browser');
The provided value 'chrome' is not a valid browser from 'apps'.
On MacOS, 'chrome' is not a recognized application name.
fix
Use apps.chrome or 'Google Chrome' (full application name) for MacOS.
Upgrade
Version history
2.0.2latest on npm
Audit
Dependencies
webpackoptionalpeer dependency required for plugin use
openrequiredused for opening URLs in browsers
Agent activity
8 hits · last 30 days
node
8
Resources
webpack-open-browser — npm install webpack-open-browser · libregistry