<commit_before>'use strict';

const ExtractText = require('extract-text-webpack-plugin');
const HtmlWebpack = require('html-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const ChunkWebpack = webpack.optimize.CommonsChunkPlugin;
const ContextReplacementPlugin = webpack.ContextReplacementPlugin;
const LoaderOptionsPlugin = webpack.LoaderOptionsPlugin;

const entryPoints = [
    'vendor',
    'scripts',
    'styles',
    'app'
];
const rootDir = process.cwd();
const examples = path.resolve(rootDir, 'examples');
const src = path.resolve(rootDir, 'src');

module.exports = {
    devServer: {
        contentBase: path.resolve(rootDir, 'dist'),
        port: 9000
    },
    devtool: 'source-map',
    entry: {
        app: [ path.resolve(examples, 'example.main') ],
        scripts: [],
        vendor: [ path.resolve(src, 'vendor') ],
        styles: [ path.resolve(examples, 'styles.scss') ]
    },
    module: {
        loaders: [
            { loader: 'raw-loader', test: /\.html$/ },
            {
                exclude: [src, examples],
                loader: ExtractText.extract({
                    fallbackLoader: 'style-loader',
                    loader: 'css-loader?sourceMap'
                }),
                test: /\.css$/
            },
            {
                exclude: [path.resolve(examples, 'styles.scss'), /node_modules/],
                loaders: ['css-to-string-loader', 'css-loader', 'sass-loader'],
                test: /\.scss$/
            },
            {
                include: examples,
                loaders: ['style-loader', 'css-loader', 'sass-loader'],
                test: /styles\.scss$/
            },
            {
                exclude: /node_modules/,
                loaders: ['css-to-string-loader', 'css-loader'],
                test: /\.css$/
            },
            {
                exclude: /node_modules/,
                loaders: ['awesome-typescript-loader', 'angular2-template-loader?keepUrl=true'],
                test: /\.ts$/
            },
            {
                loaders: ['url-loader?limit=10000'],
                test: /\.(woff2?|ttf|eot|svg|jpg|jpeg|json|gif|png)(\?v=\d+\.\d+\.\d+)?$/
            }
        ]
    },
    output: {
        filename: '[name].bundle.js',
        path: path.resolve(rootDir, 'dist')
    },
    performance: { hints: false },
    plugins: [
        new ChunkWebpack({
            filename: 'vendor.bundle.js',
            minChunks: Infinity,
            name: 'vendor'
        }),
        new ContextReplacementPlugin(
            /angular(\\|\/)core(\\|\/)((esm(\\|\/)src|src)(\\|\/)linker|@angular)/,
            __dirname
        ),
        new LoaderOptionsPlugin({
            debug: true,
            options: {
                emitErrors: true
            }
        }),
        new HtmlWebpack({
            filename: 'index.html',
            inject: 'body',
            template: path.resolve(rootDir, 'examples', 'index.html')
        })<commit_msg>Webpack HTML needed to be chunky<commit_after>'use strict';

const ExtractText = require('extract-text-webpack-plugin');
const HtmlWebpack = require('html-webpack-plugin');
const path = require('path');
const webpack = require('webpack');
const ChunkWebpack = webpack.optimize.CommonsChunkPlugin;
const ContextReplacementPlugin = webpack.ContextReplacementPlugin;
const LoaderOptionsPlugin = webpack.LoaderOptionsPlugin;

const entryPoints = [
    'vendor',
    'scripts',
    'styles',
    'app'
];
const rootDir = process.cwd();
const examples = path.resolve(rootDir, 'examples');
const src = path.resolve(rootDir, 'src');

module.exports = {
    devServer: {
        contentBase: path.resolve(rootDir, 'dist'),
        port: 9000
    },
    devtool: 'source-map',
    entry: {
        app: [ path.resolve(examples, 'example.main') ],
        scripts: [],
        vendor: [ path.resolve(src, 'vendor') ],
        styles: [ path.resolve(examples, 'styles.scss') ]
    },
    module: {
        loaders: [
            { loader: 'raw-loader', test: /\.html$/ },
            {
                exclude: [src, examples],
                loader: ExtractText.extract({
                    fallbackLoader: 'style-loader',
                    loader: 'css-loader?sourceMap'
                }),
                test: /\.css$/
            },
            {
                exclude: [path.resolve(examples, 'styles.scss'), /node_modules/],
                loaders: ['css-to-string-loader', 'css-loader', 'sass-loader'],
                test: /\.scss$/
            },
            {
                include: examples,
                loaders: ['style-loader', 'css-loader', 'sass-loader'],
                test: /styles\.scss$/
            },
            {
                exclude: /node_modules/,
                loaders: ['css-to-string-loader', 'css-loader'],
                test: /\.css$/
            },
            {
                exclude: /node_modules/,
                loaders: ['awesome-typescript-loader', 'angular2-template-loader?keepUrl=true'],
                test: /\.ts$/
            },
            {
                loaders: ['url-loader?limit=10000'],
                test: /\.(woff2?|ttf|eot|svg|jpg|jpeg|json|gif|png)(\?v=\d+\.\d+\.\d+)?$/
            }
        ]
    },
    output: {
        filename: '[name].bundle.js',
        path: path.resolve(rootDir, 'dist')
    },
    performance: { hints: false },
    plugins: [
        new ChunkWebpack({
            filename: 'vendor.bundle.js',
            minChunks: Infinity,
            name: 'vendor'
        }),
        new ContextReplacementPlugin(
            /angular(\\|\/)core(\\|\/)((esm(\\|\/)src|src)(\\|\/)linker|@angular)/,
            __dirname
        ),
        new LoaderOptionsPlugin({
            debug: true,
            options: {
                emitErrors: true
            }
        }),
        new HtmlWebpack({
            // shameless/shamefully stolen from Angular CLI
            chunksSortMode: function(left, right) {
                const leftIndex = entryPoints.indexOf(left.names[0]);
                const rightIndex = entryPoints.indexOf(right.names[0]);
                let direction = 0;

                if (leftIndex > rightIndex) {
                    direction = 1;
                } else if (leftIndex < rightIndex) {
                    direction = -1;
                }

                return direction;
            },
            filename: 'index.html',
            inject: 'body',
            template: path.resolve(rootDir, 'examples', 'index.html')
        })
{'fraction_non_alphanumeric': 0.15090329436769395, 'fraction_numerical': 0.004098982844997723, 'mean_word_length': 1.5714285714285714, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '4662836', 'n_tokens_mistral': 1937, 'n_tokens_neox': 1815, 'n_words': 339}