gulpwebpackgulp-watcheslintwebpack-watch

Webpack out stops working on ESLint Errors.


I am not sure what the problem is. I don't want to turn emitWarnings = true because I want the emit to fail during eslint errors and to resume after eslint errors.

How do allow output to continue to write after fixing eslint errors?

I have tried a few options from:

https://github.com/MoOx/eslint-loader#gotchas

One thing to note: I am running webpack through Gulp.

Webpack Config:

const webpack = require('webpack');
const path = require('path');
const glob = require('glob');

const PATHS = {
  scriptApp: path.join(__dirname, '/Scripts/App'),
  script: path.join(__dirname, '/Scripts/')
};

module.exports = {
    entry: {
        index1: [PATHS.scriptApp + '/index'],
    },
    devtool: 'eval-source-map',
    module: {
        preLoaders: [
            { test: /\.js$/, loader: 'eslint', exclude: 'node_modules' },
        ],
        loaders: [
            { test: /\.js$/, loader: 'babel-loader', exclude: 'node_modules' },
            { test: /\.dot$/, loader: "dot-loader" } 
        ]
    },
    output: {
        path: path.join(__dirname, '/scripts/app/build'),
        filename: '[name].bundle.js'
    },
    resolve: {
        extensions: ['', '.js', '.dot']
    },
    'dust-loader-complete': {
      wrapperGenerator: function (name) {return "function( context, callback ) { dust.render( '" + name + "', context, callback ); }";}
    },
    plugins: [
        new webpack.optimize.OccurenceOrderPlugin(),
        new webpack.PrefetchPlugin('jquery'),
        new webpack.PrefetchPlugin('lodash'),
        new webpack.ProvidePlugin({
            $: 'jquery',
            jquery: 'jQuery',
            'windows.jQuery': 'jquery',
            _: 'lodash',
            toastr: 'toastr',

        }),
        // new webpack.optimize.UglifyJsPlugin
    ],
    debug: true,
    eslint: {
      formatter: require('eslint-friendly-formatter')    
    }
};

Gulp Set up:

gulp.task('build-webpack', function (callback) {
    webpack(webpackConfig, function(err, stats) {
        if(err) throw new gutil.PluginError("webpack", err);
        gutil.log("[webpack]", stats.toString({
            // output options
        }));
        callback();
    });
});

Solution

  • It turns out it was due to my gulp-configuration with webpack-stream. When Gulp fails, the gulp watcher ignores the stream. I added Gulp-Plumber to prevent the failure.