@@ -16,7 +16,7 @@ import {Server as KarmaServer} from 'karma';
1616import runSequence from 'run-sequence' ;
1717import { protractor , webdriver_update } from 'gulp-protractor' ;
1818import { Instrumenter } from 'isparta' ;
19- import webpack from 'webpack-stream ' ;
19+ import webpack from 'webpack' ;
2020import makeWebpackConfig from './webpack.make' ;
2121
2222var plugins = gulpLoadPlugins ( ) ;
@@ -223,37 +223,25 @@ gulp.task('inject:<%= styleExt %>', () => {
223223 . pipe ( gulp . dest ( `${ clientPath } /app` ) ) ;
224224} );
225225
226- gulp.task('webpack:dev', function() {
227- const webpackDevConfig = makeWebpackConfig ( { DEV : true } ) ;
228- return gulp . src ( webpackDevConfig . entry . app )
229- . pipe ( plugins . plumber ( ) )
230- . pipe ( webpack ( webpackDevConfig ) )
231- . pipe ( gulp . dest ( '.tmp' ) ) ;
232- } );
226+ function webpackCompile(options, cb) {
227+ let compiler = webpack ( makeWebpackConfig ( options ) ) ;
233228
234- gulp.task('webpack:dist', function() {
235- const webpackDistConfig = makeWebpackConfig ( { BUILD : true } ) ;
236- return gulp . src ( webpackDistConfig . entry . app )
237- . pipe ( webpack ( webpackDistConfig ) )
238- . on ( 'error' , ( err ) => {
239- this . emit ( 'end' ) ; // Recover from errors
240- } )
241- . pipe ( gulp . dest ( `${ paths . dist } /client` ) ) ;
242- } );
229+ compiler . run ( ( err , stats ) => {
230+ if ( err ) return cb ( err ) ;
243231
244- gulp.task('webpack:test', function() {
245- const webpackTestConfig = makeWebpackConfig ( { TEST : true } ) ;
246- return gulp . src ( webpackTestConfig . entry . app )
247- . pipe ( webpack ( webpackTestConfig ) )
248- . pipe ( gulp . dest ( '.tmp' ) ) ;
249- } );
232+ plugins . util . log ( stats . toString ( {
233+ colors : true ,
234+ timings : true ,
235+ chunks : options . BUILD
236+ } ) ) ;
237+ cb ( ) ;
238+ } ) ;
239+ }
250240
251- gulp.task('webpack:e2e', function() {
252- const webpackE2eConfig = makeWebpackConfig ( { E2E : true } ) ;
253- return gulp . src ( webpackE2eConfig . entry . app )
254- . pipe ( webpack ( webpackE2eConfig ) )
255- . pipe ( gulp . dest ( '.tmp' ) ) ;
256- } );< % if ( filters . ts ) { % >
241+ gulp.task('webpack:dev', cb => webpackCompile ( { DEV : true } , cb));
242+ gulp.task('webpack:dist', cb => webpackCompile ( { BUILD : true } , cb));
243+ gulp.task('webpack:test', cb => webpackCompile ( { TEST : true } , cb));
244+ < % _ if ( filters . ts ) { - % >
257245
258246// Install DefinitelyTyped TypeScript definition files
259247gulp.task('typings', () => {
@@ -282,7 +270,7 @@ gulp.task('lint:scripts', cb => runSequence(['lint:scripts:client', 'lint:script
282270gulp . task ( 'lint:scripts:client' , ( ) => {
283271 return gulp . src ( _ . union (
284272 paths . client . scripts ,
285- _ . map ( paths . client . test , blob => '!' + blob )
273+ _ . map ( paths . client . test , blob => `! ${ blob } ` )
286274 ) )
287275 . pipe ( lintClientScripts ( ) ) ;
288276} ) ;
@@ -311,8 +299,8 @@ gulp.task('jscs', () => {
311299gulp . task ( 'clean:tmp' , ( ) => del ( [ '.tmp/**/*' ] , { dot : true } ) ) ;
312300
313301gulp . task ( 'start:client' , cb => {
314- whenServerReady ( ( ) => {
315- open ( ' http://localhost:' + config . browserSyncPort ) ;
302+ return require ( './webpack.server' ) . start ( config . clientPort ) . then ( ( ) => {
303+ open ( ` http://localhost:${ config . clientPort } ` ) ;
316304 cb ( ) ;
317305 } ) ;
318306} ) ;
@@ -461,7 +449,7 @@ gulp.task('coverage:integration', () => {
461449// Downloads the selenium webdriver
462450gulp . task ( 'webdriver_update' , webdriver_update ) ;
463451
464- gulp . task ( 'test:e2e' , [ 'webpack:e2e ' , 'env:all' , 'env:test' , 'start:server' , 'webdriver_update' ] , cb => {
452+ gulp . task ( 'test:e2e' , [ 'webpack:dist ' , 'env:all' , 'env:test' , 'start:server' , 'webdriver_update' ] , cb => {
465453 gulp . src ( paths . client . e2e )
466454 . pipe ( protractor ( {
467455 configFile : 'protractor.conf.js' ,
0 commit comments