text: /* global __dirname, require, module*/
  
  const path = require('path');
  const env = require('yargs').argv.env; // use --env with webpack 2
  const pkg = require('./package.json');
  
  let libraryName = pkg.name;
  
  let outputFile, mode;
  
  if (env === 'build') {
    mode = 'production';
    outputFile = libraryName + '.min.js';
  } else {
    mode = 'development';
    outputFile = libraryName + '.js';
  }
  
  const config = {
    mode: mode,
    entry: __dirname + '/src/plugin.datepicker.js',
    devtool: 'source-map',
    output: {
      path: __dirname + '/dist',
      filename: outputFile,
      library: libraryName,
      libraryTarget: 'umd',
      umdNamedDefine: true,
      globalObject: "typeof self !== 'undefined' ? self : this"
    },
    module: {
      rules: [{
        test: /\.html$/,
        use: [{
          loader: 'angular-templatecache-loader'
        }]
      }, {
        test: /(\.jsx|\.js)$/,
        exclude: /node_modules/,
        loader: 'babel-loader',
        options: {
          presets: ['@babel/preset-env']
        }
      }]
    },
    resolve: {
      modules: [path.resolve('./node_modules'), path.resolve('./src')],
      extensions: ['.json', '.js']
    }
  };
  
  module.exports = config;
  