Opens the browser when Webpack is ready serving your files.
npm install opn-browser-webpack-plugin```
npm install opn-browser-webpack-plugin --save-dev
Simply require the plugin and add it in the plugins section:
`javascript
var OpenBrowserPlugin = require('opn-browser-webpack-plugin');
module.exports = {
entry: path.resolve(__dirname, 'lib/entry.js'),
output: {
path: __dirname + "/bundle/",
filename: "bundle.js"
},
plugins: [
new OpenBrowserPlugin({ url: 'http://localhost:3000' })
]
};
`
#### url
Type: Stringhttp://localhost:8080
Default:
Url to open when Webpack is ready. Needs to have the prefix http:// or https:// in order to open the browser.
#### delay
Type: Number0
Default:
Optional
By default the browser is opened immediately, but this could be too early in some cases (eg. starting a nodeJS server).
The value is specified in milliseconds.
#### browser
Type: String
Optional
Browser to open. By default, it will try to open the browser set by default in your system.
#### ignoreErrors
Type: BooleanFalse`
Default:
Optional
By default this plugin only opens the browser if there's no Webpack errors. Setting ignoreErrors to true will open a new tab no matter the compilation errors.
#### Removed
- DEFAULT_BROWSER constant.
MIT License.