title: Trying to concatenate js files with webpack (like a gulp script)
body: <p>I want to reproduce this Gulp script with webpack to have only one process who listen on files but i can't make it work. This is my Gulp task</p>
  
  <pre><code>gulp.task('scripts', function(){
  
  return gulp.src( WATCH_SCRIPTS.SCRIPTS )
    .pipe(plumber())
    .pipe(sourcemaps.init())
    .pipe(concat('plugins.min.js'))
    .pipe(babel({ compact: false, babelrc: false, presets: ['es2015-allow-top-level-this'] }))
    .pipe(ifElse(PROD_ENV,
      () =&gt; {return uglify({
        hoist_vars: true,
        global_defs: {
          jQuery: false,
          $: false,
        }
      })},
      () =&gt; {return sourcemaps.write('./')}
    ))
    .pipe(plumber.stop())
    .pipe(gulp.dest(BUILD_PATH + '/js'));
  });
  </code></pre>
  
  <p>I tried with the expose-loader, but it always misses some dependancies.</p>
  
  <pre><code>{
    name: 'scripts',
    target: 'web',
    entry: glob.sync('./src/assets/js/**/*.js'),
    devtool: 'cheap-module-eval-source-map',
    output: {
      path: path.resolve(__dirname, 'public/js/'),
      filename: 'plugins.min.js',
      sourceMapFilename: 'plugins.min.js.map',
    },
    module: {
      rules: [
        {
          test: /[\/]global\.js$/,
          use: [{
            loader: 'expose-loader',
            options: 'Materialize'
          }]
        },
        {
          test: /[\/]jquery\.js$/,
          use: [{
            loader: 'expose-loader',
            options: 'jQuery'
          },{
            loader: 'expose-loader',
            options: '$'
          }]
        }
      ]
    }
  }
  </code></pre>
  
  <p>I tried with the babel-loader with the preset (like in the gulp task)</p>
  
  <pre><code>presets: ['es2015-allow-top-level-this']
  </code></pre>
  
  <p>Materialize was undefined from this file <a href="https://github.com/Dogfalo/materialize/blob/master/js/global.js" rel="nofollow noreferrer">https://github.com/Dogfalo/materialize/blob/master/js/global.js</a>.</p>
  
  <p>Can i just listen to files changes and start my <code>gulp scripts</code> or is there a way to concatenate files directly? I'm very new to webpack 2.</p>
  
  <p>Thank you</p>