var webpack = require('webpack');
var isProd = (process.env.NODE_ENV === 'production');

// minimize only in production
var plugins = isProd ? [new webpack.optimize.UglifyJsPlugin({minimize: true})] : []

module.exports = {
  entry: ['./src/remotestorage.js'],
  // source map not in production
  devtool: isProd ? 'source-map' : '',
  output: {
    filename: __dirname + '/release/' + (isProd?'stable':'head') + '/remotestorage.js',
    library: 'RemoteStorage',
    libraryTarget: 'umd',
    umdNamedDefine: true
  },
  externals: [ 'xmlhttprequest' ],
  plugins: plugins
};

@@ -309,16 +309,17 @@
 Prod ? '
+#
 source-m
@@ -325,16 +325,32 @@
 map' : '
+#eval-source-map
 ',%0A  out
@@ -583,12 +583,212 @@
  plugins
+,%0A  module: %7B%0A    loaders: %5B%0A      %7B%0A        test: /%5C.js$/,%0A        exclude: /node_modules/,%0A        loader: 'babel-loader',%0A        query: %7B%0A          presets: %5B'es2015'%5D%0A        %7D%0A%0A      %7D%0A    %5D%0A  %7D
 %0A%7D;%0A

add ES6 transpiling support with babel! source-map fix