<commit_before>const webpack = require('webpack');
const path = require('path');
const WebpackNotifierPlugin = require('webpack-notifier');
const packageName = require('../package.json').name;

let finalPackageName;

let outputPath = path.resolve('build/build-es5');

// transpiling to ES6? (for editor and for some browsers)
const TO_ES6 = process.env.NODE_ENV === 'es6';

// deploying? (for complete games)
const DEPLOYING = process.env.NODE_ENV === 'production';

// default loaders when transpiling to ES5 (for running on every browser
// .ts(x) files should first pass through the Typescript loader, and then through babel
let loadersSetup = [
    {
        loader: 'babel-loader',
        options: {
            plugins: ['transform-runtime'],
            presets: [['es2015', { modules: false }], 'stage-3'],
        }
    },
    {
        loader: 'ts-loader'
    }
];

// if transpiling to ES6
if (TO_ES6) {
    // remove babel loader that would otherwise transpile to ES5
    loadersSetup.shift();
    outputPath = path.resolve('build/build-es6');
    finalPackageName = packageName + ".js";

} else {
    // ES5 - default case
    finalPackageName = packageName + '.browser.js';
}

if (DEPLOYING) {
    // also ES5, but minified
    finalPackageName = packageName + '.browser.min.js';
    outputPath = path.resolve('build/dist');
}

let config = {
    // TODO: check if targeting electron with webpack is better in some way (i.e., target: electron)

    // devtool is already set with -d (debug) and removed with -p (production) flags from webpack and webpack dev server
    // devtool: 'source-map',

    // Library (or app) entry point (webpack will look for it in the 'src' directory due to the modules setting below).
    entry: [
        'index.ts'
    ],
    // Output the bundled JS to dist/app.js
    output: {
        filename: finalPackageName,
        path: outputPath,
        // export itself to a global var
        libraryTarget: "var",
        // name of the global var
        library: "TE",
        // webpack dev server hot reload path
        publicPath: "/build/build-es5/"
    },<commit_msg>feat(live-server): Make webpack more configurable<commit_after>const webpack = require('webpack');
const path = require('path');
const WebpackNotifierPlugin = require('webpack-notifier');
const packageName = require('../package.json').name;

// transpiling to ES6? (for editor and for some browsers)
const TO_ES6 = process.env.NODE_ENV === 'es6';

// deploying? (for complete games)
const DEPLOYING = process.env.NODE_ENV === 'production';

// the variable name from which the library should be accessed from
const globalLibraryName = 'TE';

// the entry filename of the library (inside src)
const entryFilename = 'index.ts'

// default package name (ES5)
let finalPackageName = packageName + '.browser.js';

// default relative output path
// it changes depending on the target (i.e., ES6, production or ES5 by default)
let relativeOutputPath = 'build/build-es5';

// default loaders when transpiling to ES5 (for running on every browser
// .ts(x) files should first pass through the Typescript loader, and then through babel
let loadersSetup = [
    {
        loader: 'babel-loader',
        options: {
            plugins: ['transform-runtime'],
            presets: [['es2015', { modules: false }], 'stage-3'],
        }
    },
    {
        loader: 'ts-loader'
    }
];

// if transpiling to ES6
if (TO_ES6) {
    // remove babel loader that would otherwise transpile to ES5
    loadersSetup.shift();
    // update output path
    relativeOutputPath = 'build/build-es6';
    // update package name
    finalPackageName = packageName + ".js";
} else if (DEPLOYING) {
    // update output path
    relativeOutputPath = 'build/dist';
    // update package name to an ES5 minified version
    finalPackageName = packageName + '.browser.min.js';
}

const config = {
    // TODO: check if targeting electron with webpack is better in some way (i.e., target: electron)

    // devtool is already set with -d (debug) and removed with -p (production) flags from webpack and webpack dev server
    // devtool: 'source-map',

    // Library (or app) entry point (webpack will look for it in the 'src' directory due to the modules setting below).
    entry: [
        entryFilename
    ],
    // Output the bundled JS to dist/app.js
    output: {
        filename: finalPackageName,
        path: path.resolve(relativeOutputPath),
        // export itself to a global var
        libraryTarget: "var",
        // name of the global var
        library: globalLibraryName,
        // webpack dev server hot reload path
        publicPath: relativeOutputPath
    },
{'fraction_non_alphanumeric': 0.11455439196409489, 'fraction_numerical': 0.007480230818550973, 'mean_word_length': 2.848684210526316, 'pattern_counts': {'":': 0, '<': 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': '1039590', 'n_tokens_mistral': 1356, 'n_tokens_neox': 1326, 'n_words': 477}