Skip to content

Gulp task for angular projects to transpile and bundle JavaScript/TypeScript sources with webpack

License

Notifications You must be signed in to change notification settings

vianch/webpack-gulp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webpack Task

Use webpack to transpile and bundle your source files.

You will need to provide a webpack.config.js file in your project root. For more information on webpack configuration, see https://webpack.github.io/docs/configuration.html.

API

webpackBuild([options])

Returns a Promise that resolves when the build is finished if there are no errors, and rejects if there are build errors. Use the failOnWarning option to also reject when there are build warnings.

Available options:

  • watch (boolean) Whether to watch for changes or not. Default: false.
  • watchOptions (Object) Watch options for webpack. Default: null.
  • config (Object) Configuration for webpack. Default: uses webpack.config.js from your project root.
  • failOnWarning (boolean) Whether to reject on warning or not. Default: false.
  • statsOptions (Object) Stats options for webpack. Default:
{
  'colors': true,
  'modules': false,
  'chunks': false,
  'exclude': ['node_modules']
}

Example

var webpackBuild = require('webpack-gulp');

gulp.task('build', webpackBuild);

gulp.task('watch', function(){
  return webpackBuild({
    watch: true,
    statsOptions: {
      'colors': false,
      'errorDetails': true
    }  
  })
});

Example 2

var webpackBuild = require('webpack-gulp');
var webpackConfig = require('webpack.production.js');

gulp.task('build', webpackBuild);

gulp.task('watch', function(){
  return webpackBuild({
    config: webpackConfig  
  })
});

Full Example

About

Gulp task for angular projects to transpile and bundle JavaScript/TypeScript sources with webpack

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published