Skip to content
Closed
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
var PORT = process.env.PORT || 3000;

var path = require('path');
var autoprefixer = require('autoprefixer');
Expand All @@ -32,7 +33,7 @@ var buildPath = path.join(__dirname, isInNodeModules ? '../../..' : '..', 'build
module.exports = {
devtool: 'eval',
entry: [
require.resolve('webpack-dev-server/client') + '?http://localhost:3000',
require.resolve('webpack-dev-server/client') + '?http://localhost:'+PORT,
require.resolve('webpack/hot/dev-server'),
path.join(srcPath, 'index')
],
Expand Down Expand Up @@ -60,7 +61,7 @@ module.exports = {
],
loaders: [
{
test: /\.js$/,
test: /\.js(|x)$/,
include: srcPath,
loader: 'babel',
query: require('./babel.dev')
Expand Down
9 changes: 5 additions & 4 deletions scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

process.env.NODE_ENV = 'development';
var PORT = process.env.PORT || 3000;

var path = require('path');
var chalk = require('chalk');
Expand Down Expand Up @@ -77,7 +78,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 http://localhost:'+PORT+'/');
console.log();
return;
}
Expand Down Expand Up @@ -130,7 +131,7 @@ function openBrowser() {
execSync(
'osascript ' +
path.resolve(__dirname, './openChrome.applescript') +
' http://localhost:3000/'
' http://localhost:'+PORT+'/'
);
return;
} catch (err) {
Expand All @@ -139,15 +140,15 @@ function openBrowser() {
}
// Fallback to opn
// (It will always open new tab)
opn('http://localhost:3000/');
opn('http://localhost:'+PORT+'/');
}

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