Skip to content

Commit 0fea4f5

Browse files
committed
WIP.
1 parent a33b5a2 commit 0fea4f5

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[![npm version](https://badge.fury.io/js/webpack-browser-plugin.svg)](https://badge.fury.io/js/webpack-browser-plugin)
22
![](https://reposs.herokuapp.com/?path=1337programming/webpack-browser-plugin)
33
[![npm](https://img.shields.io/npm/dm/webpack-browser-plugin.svg)]()
4+
# Work In Progress!!
45
# Webpack Browser Plugin
56

67
This plugin enables your webpack builds to automatically launch it's application on a browser.

lib/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ var WebpackShellPlugin = function () {
4545
port: 8080,
4646
browser: 'default'
4747
};
48-
this.options = mergeOptions(options, defaultOptions);
48+
if (options) {
49+
this.options = mergeOptions(options, defaultOptions);
50+
} else {
51+
this.options = defaultOptions;
52+
}
4953
}
5054

5155
babelHelpers.createClass(WebpackShellPlugin, [{
@@ -59,7 +63,7 @@ var WebpackShellPlugin = function () {
5963
this.options.port = compiler.options.devServer.port;
6064
}
6165

62-
compiler.plugin('done', function (compilation, callback) {
66+
compiler.plugin('emit', function (compilation, callback) {
6367
if (compilation.compiler._plugins['watch-run']) {
6468
// Running in dev-server @todo check and validate this
6569
var open = require('open');

src/webpack-browser-plugin.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ export default class WebpackShellPlugin {
1414
port: 8080,
1515
browser: 'default'
1616
};
17-
this.options = mergeOptions(options, defaultOptions);
17+
if (options) {
18+
this.options = mergeOptions(options, defaultOptions);
19+
} else {
20+
this.options = defaultOptions;
21+
}
1822
}
1923

2024
apply(compiler) {
@@ -24,7 +28,7 @@ export default class WebpackShellPlugin {
2428
this.options.port = compiler.options.devServer.port;
2529
}
2630

27-
compiler.plugin('done', (compilation, callback) => {
31+
compiler.plugin('emit', (compilation, callback) => {
2832
if (compilation.compiler._plugins['watch-run']) {
2933
// Running in dev-server @todo check and validate this
3034
const open = require('open');

0 commit comments

Comments
 (0)