Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

Commit b03c7a4

Browse files
committed
Make build script compatible with node 4
Certain es6 features like destructuring and default parameters are not supported by node 4.x.
1 parent 1c5c665 commit b03c7a4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/react-scripts/scripts/build.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var FileSizeReporter = require('react-dev-utils/FileSizeReporter');
3131
var measureFileSizesBeforeBuild = FileSizeReporter.measureFileSizesBeforeBuild;
3232
var printFileSizesAfterBuild = FileSizeReporter.printFileSizesAfterBuild;
3333

34-
var { highlight } = require('cli-highlight');
34+
var highlight = require('cli-highlight').highlight;
3535

3636
var useYarn = fs.existsSync(paths.yarnLockFile);
3737

@@ -40,7 +40,8 @@ if (!checkRequiredFiles([paths.appHtml, paths.appIndexJs])) {
4040
process.exit(1);
4141
}
4242

43-
function padLeft(n, nr, str = ' '){
43+
function padLeft(n, nr, str){
44+
str = str === undefined ? ' ' : str;
4445
return Array(n-String(nr).length+1).join(str)+nr;
4546
}
4647

@@ -66,7 +67,8 @@ function printErrors(summary, errors) {
6667
let linePointer;
6768
if (err.loaderSource === 'ts-loader') {
6869
if (err.file) {
69-
const { line, character } = err.location;
70+
const line = err.location.line;
71+
const character = err.location.character;
7072
const longestLineNumber = Array.from({ length: 7 }).map((_, i) => (line - 3) + i).reduce((a, b) => String(a).length === String(b).length ? String(a).length : String(a).length > String(b).length ? String(a).length : String(b).length);
7173
const fileContent = highlight(fs.readFileSync(err.file, 'utf8'), { language: 'typescript' })
7274
.split('\n');

0 commit comments

Comments
 (0)