<commit_before>import { join } from 'path';
import { yellow, underline } from 'chalk';

import { getSettings, getAbsolutePath, fileExists } from 'roc';
import { getValueFromPotentialObject } from 'roc-package-base-dev';

import runThroughBabel from '../helpers/run-through-babel';
import { writeStats } from './utils/stats';
import { addTrailingSlash, getDevPath } from '../helpers';

/**
 * Creates a builder.
 *
 * @param {!string} target - a target: should be either "client" or "server"
 * @param {rocBuilder} rocBuilder - A rocBuilder to base everything on.
 * @returns {rocBuilder}
 */
export default ({ previousValue: { buildConfig = {}, builder = require('webpack') } = {} }) => (target) => () => {
    const buildSettings = getSettings('build');

    const DEV = (buildSettings.mode === 'dev');
    const DIST = (buildSettings.mode === 'dist');

    let ENV = DIST ? 'production' : null;
    ENV = DEV ? 'development' : buildSettings.mode;

    const entry = getAbsolutePath(getValueFromPotentialObject(buildSettings.input, target));
    const outputPath = getAbsolutePath(getValueFromPotentialObject(buildSettings.output, target));
    const outputName = getValueFromPotentialObject(buildSettings.name, target);

    if (!fileExists(entry)) {
        console.log(yellow(`Could not find the entry file for ${underline(target)} at ` +
            `${underline(entry)}`));

        return {};
    }

    if (DIST) {
        buildConfig.bail = true;
    }

    /**
    * Entry
    */
    buildConfig.entry = {
        [outputName]: [
            entry
        ]
    };

    /**
    * Devtool
    */
    buildConfig.devtool = 'source-map';
<commit_msg>Fixed regression from #8<commit_after>import { join } from 'path';
import { yellow, underline } from 'chalk';

import { getSettings, getAbsolutePath, fileExists } from 'roc';
import { getValueFromPotentialObject } from 'roc-package-base-dev';

import runThroughBabel from '../helpers/run-through-babel';
import { writeStats } from './utils/stats';
import { addTrailingSlash, getDevPath } from '../helpers';

/**
 * Creates a builder.
 *
 * @param {!string} target - a target: should be either "client" or "server"
 * @param {rocBuilder} rocBuilder - A rocBuilder to base everything on.
 * @returns {rocBuilder}
 */
export default ({ previousValue: { buildConfig = {}, builder = require('webpack') } = {} }) => (target) => () => {
    const buildSettings = getSettings('build');

    const DEV = (buildSettings.mode === 'dev');
    const DIST = (buildSettings.mode === 'dist');

    let ENV = buildSettings.mode;
    if (DIST) {
        ENV = 'production';
    } else if (DEV) {
        ENV = 'development';
    }

    const entry = getAbsolutePath(getValueFromPotentialObject(buildSettings.input, target));
    const outputPath = getAbsolutePath(getValueFromPotentialObject(buildSettings.output, target));
    const outputName = getValueFromPotentialObject(buildSettings.name, target);

    if (!fileExists(entry)) {
        console.log(yellow(`Could not find the entry file for ${underline(target)} at ` +
            `${underline(entry)}`));

        return {};
    }

    if (DIST) {
        buildConfig.bail = true;
    }

    /**
    * Entry
    */
    buildConfig.entry = {
        [outputName]: [
            entry
        ]
    };

    /**
    * Devtool
    */
    buildConfig.devtool = 'source-map';

{'fraction_non_alphanumeric': 0.14527629233511585, 'fraction_numerical': 0.00029708853238265005, 'mean_word_length': 3.146551724137931, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7054765', 'n_tokens_mistral': 1003, 'n_tokens_neox': 963, 'n_words': 246}