Skip to content

Commit

Permalink
use start without watcher using --no-watch (#44237)
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme authored Feb 2, 2023
1 parent 05bea6d commit b1291dd
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/scripts/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,14 @@ process.env.WP_SRC_DIRECTORY = hasArgInCLI( '--webpack-src-dir' )
? getArgFromCLI( '--webpack-src-dir' )
: 'src';

const { status } = spawn(
resolveBin( 'webpack' ),
[ hasArgInCLI( '--hot' ) ? 'serve' : 'watch', ...getWebpackArgs() ],
{
stdio: 'inherit',
}
);
const webpackArgs = getWebpackArgs();
if ( hasArgInCLI( '--hot' ) ) {
webpackArgs.unshift( 'serve' );
} else if ( ! hasArgInCLI( '--no-watch' ) ) {
webpackArgs.unshift( 'watch' );
}

const { status } = spawn( resolveBin( 'webpack' ), webpackArgs, {
stdio: 'inherit',
} );
process.exit( status === null ? EXIT_ERROR_CODE : status );

0 comments on commit b1291dd

Please sign in to comment.