diff --git a/index.js b/index.js index 74396e7..0c423c5 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,4 @@ -var open = require('open'); +var open = require("open"); /** * Creates a function that is restricted to invoking func once. @@ -14,7 +14,7 @@ function once(fn) { called = true; fn.apply(this, arguments); } - } + }; } /** @@ -28,7 +28,7 @@ function once(fn) { */ function OpenBrowserPlugin(options) { options || (options = {}); - this.url = options.url || 'http://localhost:8080'; + this.url = options.url || "http://localhost:8080"; this.delay = options.delay || 0; this.browser = options.browser; this.ignoreErrors = options.ignoreErrors; @@ -41,19 +41,19 @@ OpenBrowserPlugin.prototype.apply = function(compiler) { var browser = this.browser; var ignoreErrors = this.ignoreErrors; var executeOpen = once(function() { - setTimeout(function () { + setTimeout(function() { open(url, browser, function(err) { if (err) throw err; }); }, delay); - }) + }); - compiler.plugin('watch-run', function checkWatchingMode(watching, done) { + compiler.plugin("watch-run", function checkWatchingMode(watching, done) { isWatching = true; done(); }); - compiler.plugin('done', function doneCallback(stats) { + compiler.plugin("done", function doneCallback(stats) { if (isWatching && (!stats.hasErrors() || ignoreErrors)) { executeOpen(); } diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..67051dd --- /dev/null +++ b/package-lock.json @@ -0,0 +1,21 @@ +{ + "name": "open-browser-webpack-plugin", + "version": "0.0.5", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "is-wsl": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-1.1.0.tgz", + "integrity": "sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=" + }, + "open": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/open/-/open-6.3.0.tgz", + "integrity": "sha512-6AHdrJxPvAXIowO/aIaeHZ8CeMdDf7qCyRNq8NwJpinmCdXhz+NZR7ie1Too94lpciCDsG+qHGO9Mt0svA4OqA==", + "requires": { + "is-wsl": "^1.1.0" + } + } + } +} diff --git a/package.json b/package.json index 00098a0..ffb5cbf 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ }, "homepage": "https://github.com/baldore/webpack-open-plugin#readme", "dependencies": { - "open": "0.0.5" + "open": "^6.3.0" }, "devDependencies": { "webpack": "^1.12.1"