<commit_before>var path = require('path');
var webpack = require('webpack');
var merge = require('webpack-merge');

var TARGET = process.env.npm_lifecycle_event; // start (demo server) or build (production bundle)
process.env.BABEL_ENV = TARGET;

var config = {
  entry: ['./src/index.js']
};

config.output = {
  path: path.join(__dirname, 'dist'),
  filename: 'index.js'
};

config.module = {
  loaders: [
    {
      test: /\.js$/,
      loaders: ['babel'],
      exclude: /node_modules/
    }
  ]
};


// dev server
if (TARGET === 'start' || !TARGET) {
  module.exports = merge(config, {
    devtool: 'inline-source-map',
    entry: ['./demo/index.js'],
    output: {
      devtoolModuleFilenameTemplate: '[resourcePath]',
      devtoolFallbackModuleFilenameTemplate: '[resourcePath]?[hash]'
    },
    devServer: {
      contentBase: './demo',
      hot: true,
      inline: true,
      progress: true,
      stats: 'error-only'
    },
    plugins: [
      new webpack.HotModuleReplacementPlugin()
    ]
  });
}


// karma and friends
if (/^test/.test(TARGET)) {
  module.exports = merge(config, {
    devtool: 'inline-source-map',
    output: {
      devtoolModuleFilenameTemplate: '[resourcePath]',
      devtoolFallbackModuleFilenameTemplate: '[resourcePath]?[hash]'
    },
    // enzyme compat
    externals: {
      'cheerio': 'window',
      'react/addons': true,
      'react/lib/ExecutionEnvironment': true,
      'react/lib/ReactContext': true
    }
  });
}


// production build
if (TARGET === 'build') {
  module.exports = merge(config, {
    externals: {
      "react": "commonjs react",
      "react-dom": "commonjs reactdom",
      "mobiledoc-kit": "commonjs mobiledoc-kit"
    },
    plugins: [
      new webpack.DefinePlugin({
        'process.env.NODE_ENV': '"production"'
      })
    ]
  });
}<commit_msg>UMD build<commit_after>var path = require('path');
var webpack = require('webpack');
var merge = require('webpack-merge');

var TARGET = process.env.npm_lifecycle_event; // start (demo server) or build (production bundle)
process.env.BABEL_ENV = TARGET;

var config = {
  entry: ['./src/index.js']
};

config.output = {
  path: path.join(__dirname, 'dist'),
  filename: 'index.js',
  library: 'ReactMobiledocEditor',
  libraryTarget: 'umd',
  umdNamedDefine: true
};

config.module = {
  loaders: [
    {
      test: /\.js$/,
      loaders: ['babel'],
      exclude: /node_modules/
    }
  ]
};


// dev server
if (TARGET === 'start' || !TARGET) {
  module.exports = merge(config, {
    devtool: 'inline-source-map',
    entry: ['./demo/index.js'],
    output: {
      devtoolModuleFilenameTemplate: '[resourcePath]',
      devtoolFallbackModuleFilenameTemplate: '[resourcePath]?[hash]'
    },
    devServer: {
      contentBase: './demo',
      hot: true,
      inline: true,
      progress: true,
      stats: 'error-only'
    },
    plugins: [
      new webpack.HotModuleReplacementPlugin()
    ]
  });
}


// karma and friends
if (/^test/.test(TARGET)) {
  module.exports = merge(config, {
    devtool: 'inline-source-map',
    output: {
      devtoolModuleFilenameTemplate: '[resourcePath]',
      devtoolFallbackModuleFilenameTemplate: '[resourcePath]?[hash]'
    },
    // enzyme compat
    externals: {
      'cheerio': 'window',
      'react/addons': true,
      'react/lib/ExecutionEnvironment': true,
      'react/lib/ReactContext': true
    }
  });
}


// production build
if (TARGET === 'build') {
  module.exports = merge(config, {
    externals: {
      "react": "umd react",
      "react-dom": "umd reactdom",
      "mobiledoc-kit": "umd mobiledoc-kit"
    },
    plugins: [
      new webpack.DefinePlugin({
        'process.env.NODE_ENV': '"production"'
      })
    ]
  });
}
{'fraction_non_alphanumeric': 0.16657710908113918, 'fraction_numerical': 0.0, 'mean_word_length': 2.8067484662576687, 'pattern_counts': {'":': 6, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '576407', 'n_tokens_mistral': 1249, 'n_tokens_neox': 1227, 'n_words': 241}