Skip to content

Commit

Permalink
Merge pull request fabricjs#1 from af7/open-browser-plugin
Browse files Browse the repository at this point in the history
Open `localhost` automatically when bundling completes
  • Loading branch information
tbolis committed Feb 22, 2016
2 parents 6ae8985 + 139200d commit ec33606
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"material-ui": "^0.14.2",
"mocha": "^2.3.4",
"open": "0.0.5",
"open-browser-webpack-plugin": "0.0.2",
"phantomjs": "^1.9.19",
"phantomjs-prebuilt": "^2.1.3",
"react": "latest",
Expand Down
15 changes: 10 additions & 5 deletions webpack.server.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ const HotModuleReplacementPlugin = require('webpack/lib/HotModuleReplacementPlug
const srcPath = path.join(__dirname, 'src');
const examplesPath = path.join(__dirname, 'examples');

const OpenBrowserPlugin = require('open-browser-webpack-plugin');

const port = 9999;

var config = {
port: 9999,
port: port,
entry: {
examples: [
'webpack-dev-server/client?http://localhost:9999',
'webpack-dev-server/client?http://localhost:' + port,
'webpack/hot/only-dev-server',
path.join(examplesPath, 'run')
]
Expand All @@ -38,7 +42,7 @@ var config = {
stats: {colors: true},
publicPath: '/',
noInfo: false,
port: 9999,
port: port,
hot: true
},
module: {
Expand Down Expand Up @@ -71,7 +75,8 @@ var config = {
inject: 'body',
filename: 'index.html',
chunks: ['examples']
})
}),
new OpenBrowserPlugin({url: 'http://localhost:' + port}),
]
};

Expand All @@ -80,6 +85,6 @@ new WebpackDevServer(webpack(config), config.devServer)
if (err) {
console.log(err);
}
console.log('Go to http://localhost:' + config.port);
console.log('Serving from http://localhost:' + config.port);
}
);

0 comments on commit ec33606

Please sign in to comment.