Skip to content

Commit ac6d9d2

Browse files
committed
fix function declarion styles
1 parent 2252344 commit ac6d9d2

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

scripts/start.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var isSmokeTest = process.argv.some(arg =>
2727
arg.indexOf('--smoke-test') > -1
2828
);
2929
if (isSmokeTest) {
30-
handleCompile = function (err, stats) {
30+
handleCompile = (err, stats) => {
3131
if (err || stats.hasErrors() || stats.hasWarnings()) {
3232
process.exit(1);
3333
} else {
@@ -69,18 +69,19 @@ function clearConsole() {
6969
}
7070

7171
var compiler = webpack(config, handleCompile);
72-
detect(PORT, function(error, _port) {
72+
detect(PORT, (error, _port) => {
7373

7474
if (PORT !== _port) {
7575
var rl = readline.createInterface({
7676
input: process.stdin,
7777
output: process.stdout
7878
});
7979

80-
rl.question('Something is already running at http://localhost:' + PORT + '. Would you like to run the app at another port instead? [Y/n] ', function(answer){
80+
rl.question('Something is already running at http://localhost:' + PORT + '. Would you like to run the app at another port instead? [Y/n] ', answer => {
8181
if(answer === 'Y') {
8282
PORT = _port;
83-
config.entry = config.entry.map(function(c){ return c.replace(/(\d+)/g, PORT) }); // Replace the port in webpack config
83+
// Replace the port in webpack config
84+
config.entry = config.entry.map(c => c.replace(/(\d+)/g, PORT));
8485
compiler = webpack(config, handleCompile);
8586
setupCompiler();
8687
runDevServer();
@@ -94,12 +95,12 @@ detect(PORT, function(error, _port) {
9495
});
9596

9697
function setupCompiler() {
97-
compiler.plugin('invalid', function () {
98+
compiler.plugin('invalid', () => {
9899
clearConsole();
99100
console.log('Compiling...');
100101
});
101102

102-
compiler.plugin('done', function (stats) {
103+
compiler.plugin('done', stats => {
103104
clearConsole();
104105
var hasErrors = stats.hasErrors();
105106
var hasWarnings = stats.hasWarnings();
@@ -178,7 +179,7 @@ function runDevServer() {
178179
hot: true, // Note: only CSS is currently hot reloaded
179180
publicPath: config.output.publicPath,
180181
quiet: true
181-
}).listen(PORT, 'localhost', function (err, result) {
182+
}).listen(PORT, 'localhost', (err, result) => {
182183
if (err) {
183184
return console.log(err);
184185
}

0 commit comments

Comments
 (0)