title: webpack loaders and include
body: <p>I'm new to webpack and I'm trying to understand loaders as well as its properties such as test, loader, include etc.</p>
  
  <p>Here is a sample snippet of webpack.config.js that I found in google.</p>
  
  <pre><code>module: {
      loaders: [
        {
          test: /\.js$/,
          loader: 'babel-loader',
          include: [
            path.resolve(__dirname, 'index.js'),
            path.resolve(__dirname, 'config.js'),
            path.resolve(__dirname, 'lib'),
            path.resolve(__dirname, 'app'),
            path.resolve(__dirname, 'src')
          ],
          exclude: [
            path.resolve(__dirname, 'test', 'test.build.js')
          ],
          cacheDirectory: true,
          query: {
            presets: ['es2015']
          }
        },
      ]
  }
  </code></pre>
  
  <ol>
  <li><p>Am I right that test: /.js$/ will be used only for files with extension .js?</p></li>
  <li><p>The loader: 'babel-loader', is the loader we install using npm</p></li>
  <li><p>The include: I have many questions on this. Am I right that anything we put inside the array will be transpiled? That means, index.js, config.js, and all *.js files in lib, app and src will be transpiled.</p></li>
  <li><p>More questions on the include: When files get transpiled, do the *.js files get concatenated into one big file?</p></li>
  <li><p>I think exclude is self explanatory. It will not get transpiled.</p></li>
  <li><p>What does query: { presets: ['es2015'] } do?</p></li>
  </ol>