Skip to content

Commit

Permalink
Use Webpack for builds in scripts package
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Jan 10, 2019
1 parent 30eb7e2 commit 3a3c365
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 19 deletions.
15 changes: 6 additions & 9 deletions packages/scripts/scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,21 @@ const args = getCliArgs();

const hasWebpackConfig = hasCliArg( '--config' ) ||
hasProjectFile( 'webpack.config.js' ) ||
hasProjectFile( 'webpackfile.js' );
hasProjectFile( 'webpack.config.babel.js' );

let result;
if ( hasWebpackConfig ) {
// Sets environment to production.
process.env.NODE_ENV = 'production';

result = spawn(
const { status } = spawn(
resolveBin( 'webpack' ),
[ ...args ],
{ stdio: 'inherit' }
);
process.exit( status );
} else {
result = spawn(
resolveBin( 'parcel' ),
[ 'build', ...args ],
{ stdio: 'inherit' }
);
// eslint-disable-next-line no-console
console.log( 'Webpack config file is missing.' );
process.exit( 1 );
}

process.exit( result.status );
16 changes: 6 additions & 10 deletions packages/scripts/scripts/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,17 @@ const args = getCliArgs();

const hasWebpackConfig = hasCliArg( '--config' ) ||
hasProjectFile( 'webpack.config.js' ) ||
hasProjectFile( 'webpackfile.js' );
hasProjectFile( 'webpack.config.babel.js' );

let result;
if ( hasWebpackConfig ) {
result = spawn(
const { status } = spawn(
resolveBin( 'webpack' ),
[ '--watch', ...args ],
{ stdio: 'inherit' }
);
process.exit( status );
} else {
result = spawn(
resolveBin( 'parcel' ),
[ 'watch', ...args ],
{ stdio: 'inherit' }
);
// eslint-disable-next-line no-console
console.log( 'Webpack config file is missing.' );
process.exit( 1 );
}

process.exit( result.status );
File renamed without changes.

0 comments on commit 3a3c365

Please sign in to comment.