mirror of
https://github.com/zhigang1992/create-react-app.git
synced 2026-01-12 22:46:30 +08:00
Fix the order of arguments in spawned child proc (#2913)
* Fix the order of arguments in spawned child proc * Update react-scripts.js * Remove a comma * Update react-scripts.js
This commit is contained in:
committed by
Joe Haddad
parent
e12d053c27
commit
2766bbd1ff
12
packages/react-scripts/bin/react-scripts.js
vendored
12
packages/react-scripts/bin/react-scripts.js
vendored
@@ -11,8 +11,12 @@
|
||||
'use strict';
|
||||
|
||||
const spawn = require('react-dev-utils/crossSpawn');
|
||||
const script = process.argv[2];
|
||||
const args = process.argv.slice(3);
|
||||
const args = process.argv.slice(2);
|
||||
|
||||
const scriptIndex = args.findIndex(x =>
|
||||
x === 'build' || x === 'eject' || x === 'start' || x === 'test');
|
||||
const script = scriptIndex === -1 ? args[0] : args[scriptIndex];
|
||||
const nodeArgs = scriptIndex > 0 ? args.slice(0, scriptIndex) : [];
|
||||
|
||||
switch (script) {
|
||||
case 'build':
|
||||
@@ -21,7 +25,9 @@ switch (script) {
|
||||
case 'test': {
|
||||
const result = spawn.sync(
|
||||
'node',
|
||||
[require.resolve(`../scripts/${script}`)].concat(args),
|
||||
nodeArgs
|
||||
.concat(require.resolve('../scripts/' + script))
|
||||
.concat(args.slice(scriptIndex + 1)),
|
||||
{ stdio: 'inherit' }
|
||||
);
|
||||
if (result.signal) {
|
||||
|
||||
Reference in New Issue
Block a user