"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const cli_core_1 = require("@bluebase/cli-core");
const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
const webpack_merge_1 = __importDefault(require("webpack-merge"));
const path_1 = __importDefault(require("path"));
const removeNil = cli_core_1.Utils.removeNil;
/**
 * Generate index.html for client
 * @param config
 * @param builder
 */
const ClientHTML = () => (config, builder) => {
    return webpack_merge_1.default(config, {
        plugins: removeNil([
            // We need this plugin to enable hot reloading of our client.
            builder.ifDevClient(() => new html_webpack_plugin_1.default({
                filename: 'index.html',
                inject: true,
                minify: {
                    collapseWhitespace: true,
                    keepClosingSlash: true,
                    minifyCSS: true,
                    minifyJS: true,
                    minifyURLs: true,
                    removeComments: true,
                    removeRedundantAttributes: true,
                    removeStyleLinkTypeAttributes: true,
                    // removeNilAttributes: true,
                    useShortDoctype: true,
                },
                production: true,
                template: `${path_1.default.resolve(__dirname, './template.js')}`,
            })),
        ])
    });
};
exports.default = ClientHTML;
//# sourceMappingURL=index.js.map