title: How to set up webpack.config.js with babel-preset-env?
body: <p>Does anybody know or have a webpack.config.js file that uses babel-preset-env? If so, please share.</p>
  
  <p>Here is the config file:</p>
  
  <pre><code>const path = require('path');
  const webpack = require('webpack');
  const APP_DIR = path.resolve(__dirname, 'js');
  
  module.exports = {
      entry: {
          app: "./app/javascript/app-one.js",
      },
      module: {
          rules: [
              {
                  test: /\.js$/,
                  exclude: /node_modules/,
                  include : [
                  APP_DIR,
                  path.resolve(__dirname, 'node_modules/jquery')
              ],
                  use: {
                      loader: 'babel-loader',
                      options: {
                          modules: true,
                          presets: ['env',
                              {
                                  "targets": {
                                      "node": "current"
                                  }
                              }
                          ]
                      }
                  }
              }
          ]
      },
      node: {
          fs: "empty"
      },
      output: {
          path: path.resolve("./app/temp/scripts"),
          filename: "[name].bundle.js"
      }
  };
  </code></pre>