"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 assets_webpack_plugin_1 = __importDefault(require("assets-webpack-plugin"));
const webpack_merge_1 = __importDefault(require("webpack-merge"));
const removeNil = cli_core_1.Utils.removeNil;
/**
 * Generates a JSON file containing a map of all the output files for
 * our webpack bundle.  A necessisty for our server rendering process
 * as we need to interogate these files in order to know what JS/CSS
 * we need to inject into our HTML. We only need to know the assets for
 * our client bundle.
 * @param config
 * @param builder
 */
const AssetsJson = () => (config, builder) => {
    return webpack_merge_1.default(config, {
        plugins: removeNil([
            builder.ifClient(() => new assets_webpack_plugin_1.default({
                filename: builder.configs.bundleAssetsFileName,
                path: builder.configs.outputPath,
                prettyPrint: builder.isDev ? true : false,
            })),
        ]),
    });
};
exports.default = AssetsJson;
//# sourceMappingURL=AssetsJson.js.map