<commit_before>import * as CopyWebpackPlugin from "copy-webpack-plugin";
import * as HtmlWebpackPlugin from "html-webpack-plugin";
import SuppressChunksPlugin from "suppress-chunks-webpack-plugin";
import * as ExtractTextPlugin from "extract-text-webpack-plugin";
import { SlimConfig } from "../config/slim-typings/slim-config";
import { RemoveScriptsPlugin } from "./plugins/remove-scripts.plugin";
import { argv } from "yargs";
import * as path from "path";
import * as UglifyJsPlugin from "uglifyjs-webpack-plugin";

export function getBuildConfigPartial(config: SlimConfig, minify: boolean, indexPath: string, skipSourceMaps: boolean): any {
    let plugins = [
        new HtmlWebpackPlugin({
            template: indexPath
        }),
        new CopyWebpackPlugin(config.assets.entries),
        new SuppressChunksPlugin([
            { name: "styles", match: /\.js/ }
        ]),
        new RemoveScriptsPlugin(["styles.js"]),
        new ExtractTextPlugin("styles.css")
    ];
    if (minify) {
        plugins.push(new UglifyJsPlugin((<any>{
            beautify: false,
            comments: false,
            mangle: { screw_ie8: true },
            compress: {
                screw_ie8: true,
                warnings: argv["debug"],
                sequences: true,
                dead_code: true,
                conditionals: true,
                comparisons: true,
                drop_debugger: true,
                evaluate: true,
                loops: true,
                booleans: true,
                unused: true,
                if_return: true,
                join_vars: true
            },
            sourceMap: !skipSourceMaps
        })));
    }<commit_msg>fix(build): include all chunks when extracting css<commit_after>import * as CopyWebpackPlugin from "copy-webpack-plugin";
import * as HtmlWebpackPlugin from "html-webpack-plugin";
import SuppressChunksPlugin from "suppress-chunks-webpack-plugin";
import * as ExtractTextPlugin from "extract-text-webpack-plugin";
import { SlimConfig } from "../config/slim-typings/slim-config";
import { RemoveScriptsPlugin } from "./plugins/remove-scripts.plugin";
import { argv } from "yargs";
import * as path from "path";
import * as UglifyJsPlugin from "uglifyjs-webpack-plugin";

export function getBuildConfigPartial(config: SlimConfig, minify: boolean, indexPath: string, skipSourceMaps: boolean): any {
    let plugins = [
        new HtmlWebpackPlugin({
            template: indexPath
        }),
        new CopyWebpackPlugin(config.assets.entries),
        new SuppressChunksPlugin([
            { name: "styles", match: /\.js/ }
        ]),
        new RemoveScriptsPlugin(["styles.js"]),
        new ExtractTextPlugin({
            filename: "[name].css",
            allChunks: true
        })
    ];
    if (minify) {
        plugins.push(new UglifyJsPlugin((<any>{
            beautify: false,
            comments: false,
            mangle: { screw_ie8: true },
            compress: {
                screw_ie8: true,
                warnings: argv["debug"],
                sequences: true,
                dead_code: true,
                conditionals: true,
                comparisons: true,
                drop_debugger: true,
                evaluate: true,
                loops: true,
                booleans: true,
                unused: true,
                if_return: true,
                join_vars: true
            },
            sourceMap: !skipSourceMaps
        })));
    }
{'fraction_non_alphanumeric': 0.10583524027459955, 'fraction_numerical': 0.0011441647597254005, 'mean_word_length': 1.9991423670668953, 'pattern_counts': {'":': 0, '<': 5, '<?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': '6420944', 'n_tokens_mistral': 964, 'n_tokens_neox': 939, 'n_words': 230}