Commit a00e1e6d authored by Jonny Buchanan's avatar Jonny Buchanan Committed by Christopher Chedeau
Browse files

Use opn to open the default browser in a cross-platform way (#4)

parent 4fe3544f
No related merge requests found
Showing with 3 additions and 6 deletions
+3 -6
......@@ -41,6 +41,7 @@
"file-loader": "^0.9.0",
"html-webpack-plugin": "^2.22.0",
"json-loader": "^0.5.4",
"opn": "^4.0.2",
"postcss-loader": "^0.9.1",
"rimraf": "^2.5.3",
"style-loader": "^0.13.1",
......
......@@ -13,6 +13,7 @@ var webpack = require('webpack');
var WebpackDevServer = require('webpack-dev-server');
var config = require('../webpack.config.dev');
var execSync = require('child_process').execSync;
var opn = require('opn');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
......@@ -39,10 +40,5 @@ new WebpackDevServer(webpack(config), {
}
console.log('Listening at http://localhost:3000/');
try {
execSync('ps cax | grep "Google Chrome"');
execSync('open -a "Google Chrome" http://localhost:3000/');
} catch(e) {
// Do nothing if Chrome isn't opened or cannot be opened
}
opn('http://localhost:3000/');
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment