<commit_before>const browserify = require('browserify');
const fs = require('fs');
const path = require('path');
const envify = require('envify/custom');
const derequire = require('derequire');

const argv = process.argv.slice(2);
const isDevBuild = /(--dev|-d)$/.test(argv[0]);

console.log(`Building ${isDevBuild ? 'development' : 'production'} bundle with Browserify...`);

browserify({
  entries: ['src/js/index.js'],
  commondir: false,
  builtins: false,
  insertGlobals: true,
  detectGlobals: true,
  insertGlobalVars: {
    process: undefined,
  },
  browserField: false,
}).transform('babelify')
  .transform(envify({
    _: 'purge',
    NODE_ENV: process.env.BUILD_DEV ? 'development' : 'production',
  }))
  .exclude('nexeres')
  .bundle((err, buf) => {
    if (err) {
      throw err;
    }
    const code = buf.toString();

    fs.writeFile(path.join('target', 'bundle.js'), derequire(code), 'utf8');
});
<commit_msg>fix dev bundle<commit_after>const browserify = require('browserify');
const fs = require('fs');
const path = require('path');
const envify = require('envify/custom');
const derequire = require('derequire');

const argv = process.argv.slice(2);
const isDevBuild = /(--dev|-d)$/.test(argv[0]);

console.log(`Building ${isDevBuild ? 'development' : 'production'} bundle with Browserify...`);

browserify({
  entries: ['src/js/index.js'],
  commondir: false,
  builtins: false,
  insertGlobals: true,
  detectGlobals: true,
  insertGlobalVars: {
    process: undefined,
  },
  browserField: false,
}).transform('babelify')
  .transform(envify({
    _: 'purge',
    NODE_ENV: isDevBuild ? 'development' : 'production'
  }))
  .exclude('nexeres')
  .bundle((err, buf) => {
    if (err) {
      throw err;
    }
    const code = buf.toString();

    fs.writeFile(path.join('target', 'bundle.js'), derequire(code), 'utf8');
});

{'fraction_non_alphanumeric': 0.18638573743922204, 'fraction_numerical': 0.0032414910858995136, 'mean_word_length': 4.306590257879656, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3049885', 'n_tokens_mistral': 635, 'n_tokens_neox': 616, 'n_words': 132}