react-torch
Version:
A lib to server-side render with react.
25 lines (24 loc) • 899 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var webpack_manifest_plugin_1 = require("webpack-manifest-plugin");
var defaults = {};
var SetManifestPlugin = /** @class */ (function () {
function SetManifestPlugin(opts) {
this.options = Object.assign({}, defaults, opts);
this.assets = {};
}
SetManifestPlugin.prototype.apply = function (compiler) {
var _this = this;
var beforeEmit = (0, webpack_manifest_plugin_1.getCompilerHooks)(compiler).beforeEmit;
beforeEmit.tap('BatmanPlugin', function (manifest) {
_this.assets = manifest;
return manifest;
});
compiler.hooks.done.tap('SetManifestPlugin', function (stats) {
// @ts-ignore
stats.assets = _this.assets;
});
};
return SetManifestPlugin;
}());
exports.default = SetManifestPlugin;