codedungeon
5/13/2016 - 6:51 PM

Default Webpack Config with lots of goodies

Default Webpack Config with lots of goodies

/**
 * webpack.config.js
 * Created: 5/10/2016 2:39 PM (merickson)
 * =============================================================================
 */

var path              = require('path')
var ProgressBarPlugin = require('progress-bar-webpack-plugin')
var msg               = require('gulp-messenger')
var webpack           = require('webpack')
var config            = require('./tasks/gulp.config')

var webpackConfig = {
  devtool: 'eval', // source-map
  entry: path.join(__dirname, 'src', config.entry),
  output: {
    path:       path.join(__dirname, config.dest),
    filename:   config.buildFilename,
    publicPath: config.publicPath
  },
  module: {
    preLoaders: [
      {test: /\.less?$/, loader: 'stylelint' }
    ],
    loaders: [
      {test: /\.js?$/, loaders: ['babel']},
      {test: /\.html?$/, loaders: ['raw']},
      {test: /\.less?$/, loaders: ['style!css!less?strictMath&noIeCompat']},
    ]
  },
  stylelint: {
    configFile: path.join(__dirname, './.stylelintrc'),
    configOverrides: {
      rules: {
        // Your rule overrides here
      }
    }
  },
  plugins: [
    new ProgressBarPlugin({
      format:  msg.chalk.yellow.bold('  Building [:bar] ') + msg.chalk.green.bold(':percent') + ' (:elapsed seconds)',
      clear:   false,
      summary: true
    }),
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        warnings: false
      }
    })
  ]
};

module.exports = webpackConfig;