webpack.config.js
function getPlugins() {
    var plugins = [];

    // Always expose NODE_ENV to webpack, you can now use `process.env.NODE_ENV`
    // inside your code for any environment checks; UglifyJS will automatically
    // drop any unreachable code.
    plugins.push(new webpack.DefinePlugin({
        "process.env": {
            NODE_ENV: JSON.stringify(process.env.NODE_ENV)
        }
    }));

    plugins.push(new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery"
    }));

    // Conditionally add plugins for Production builds.
    if (isProduction) {
        plugins.push(new webpack.optimize.UglifyJsPlugin({minimize: true}));
    } else { // Development plugins
        // ...
    }

    return plugins;
}
function getPlugins() {
    var plugins = [];

    // Always expose NODE_ENV to webpack, you can now use `process.env.NODE_ENV`
    // inside your code for any environment checks; UglifyJS will automatically
    // drop any unreachable code.
    plugins.push(new webpack.DefinePlugin({
        "process.env": {
            NODE_ENV: JSON.stringify(process.env.NODE_ENV)
        }
    }));

    plugins.push(new webpack.ProvidePlugin({
        $: "jquery",
        jQuery: "jquery"
    }));

    // Conditionally add plugins for Production builds.
    if (isProduction) {
        plugins.push(new webpack.optimize.UglifyJsPlugin({minimize: true}));
    } else { // Development plugins
        // ...
    }

    return plugins;
}
function getPlugins ( ) { var plugins = [ ] ; // Always expose NODE_ENV to webpack, you can now use `process.env.NODE_ENV` // inside your code for any environment checks; UglifyJS will automatically // drop any unreachable code. plugins . push ( new webpack . DefinePlugin ( { "process.env" : { NODE_ENV : JSON . stringify ( process . env . NODE_ENV ) } } ) ) ; plugins . push ( new webpack . ProvidePlugin ( { $ : "jquery" , jQuery : "jquery" } ) ) ; // Conditionally add plugins for Production builds. if ( isProduction ) { plugins . push ( new webpack . optimize . UglifyJsPlugin ( { minimize : true } ) ) ; } else { // Development plugins // ... } return plugins ; }
Conditionally loads plugins (mainly for production build)
@return {Array} - Array of plugins
Conditionally loads plugins ( mainly for production build )