Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ var config = require('../config/webpack.config.dev');
var execSync = require('child_process').execSync;
var opn = require('opn');

var devPort = 3000;
var devDomain = 'localhost';
var devUrl = 'http://' + devDomain + ':' + devPort;

// TODO: hide this behind a flag and eliminate dead code on eject.
// This shouldn't be exposed to the user.
var handleCompile;
Expand Down Expand Up @@ -77,7 +81,7 @@ compiler.plugin('done', function (stats) {
if (!hasErrors && !hasWarnings) {
console.log(chalk.green('Compiled successfully!'));
console.log();
console.log('The app is running at http://localhost:3000/');
console.log('The app is running at ' + devUrl);
console.log();
return;
}
Expand Down Expand Up @@ -130,7 +134,7 @@ function openBrowser() {
execSync(
'osascript ' +
path.resolve(__dirname, './openChrome.applescript') +
' http://localhost:3000/'
' ' + devUrl
);
return;
} catch (err) {
Expand All @@ -139,15 +143,15 @@ function openBrowser() {
}
// Fallback to opn
// (It will always open new tab)
opn('http://localhost:3000/');
opn(devUrl);
}

new WebpackDevServer(compiler, {
historyApiFallback: true,
hot: true, // Note: only CSS is currently hot reloaded
publicPath: config.output.publicPath,
quiet: true
}).listen(3000, function (err, result) {
}).listen(devPort, function (err, result) {
if (err) {
return console.log(err);
}
Expand Down