const
  webpack = require('webpack'),
  path = require('path'),
  version = require('./package.json').version;

module.exports = {
  mode: 'production',
  entry: './index.js',
  output: {
    path: `${__dirname}/dist`,
    filename: 'kuzzle.js',
    library: 'KuzzleSDK',
    libraryTarget: 'umd'
  },
  watch: false,
  devtool: 'source-map',
  node: {
    console: false,
    global: false,
    process: false,
    Buffer: false,
    __filename: false,
    __dirname: false,
    setImmediate: false
  },
  module: {
    rules: [
      {
        test: /\.js$/,
        loader: 'babel-loader',
        query: {
          only: [/^src/],
          presets: [
            ['env', {
              debug: true,
              modules: false
            }]]
        }
      },
      {
        test: /\.js$/,
        loader: 'eslint-loader',
        include: path.resolve(__dirname, './src/'),
        exclude: /node_modules/
      }
    ]
  },
  plugins: [
    new webpack.IgnorePlugin(/^(http|min-req-promise|package|uws)$/),
    new webpack.DefinePlugin({
      SDKVERSION: JSON.stringify(version),
      BUILT: true
    }),
    new webpack.BannerPlugin('Kuzzle javascript SDK version ' + version),
    new webpack.optimize.OccurrenceOrderPlugin()
  ]
};

@@ -35,34 +35,8 @@
 '),%0A
-  path = require('path'),%0A
   ve
@@ -78,16 +78,16 @@
 ersion;%0A
+
 %0Amodule.
@@ -269,16 +269,34 @@
 d'%0A  %7D,%0A
+  target: 'node',%0A
   watch:
@@ -532,32 +532,34 @@
        test: /%5C.
+m?
 js$/,%0A        lo
@@ -560,356 +560,98 @@
     
-loader: 'babel-loader',%0A        query: %7B%0A          only: %5B/%5Esrc/%5D,%0A          presets: %5B%0A            %5B'env', %7B%0A              debug: true,%0A              modules: false%0A            %7D%5D%5D%0A        %7D%0A      %7D,%0A      %7B%0A        test: /%5C.js$/,%0A        loader: 'eslint-loader',%0A        include: path.resolve(__dirname, './src/'),%0A        exclude: /node_modules/
+exclude: /(node_modules%7Cbower_components)/,%0A        use: %5B'babel-loader', 'eslint-loader'%5D
 %0A   

fix broken babel loader configuration