UI for Zipcoin Blue

WebWorkerHotUpdateChunkTemplatePlugin.js 1.0KB

1234567891011121314151617181920212223242526272829
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const ConcatSource = require("webpack-sources").ConcatSource;
  7. const Template = require("../Template");
  8. class WebWorkerHotUpdateChunkTemplatePlugin {
  9. apply(hotUpdateChunkTemplate) {
  10. hotUpdateChunkTemplate.plugin("render", function(modulesSource, modules, removedModules, hash, id) {
  11. const chunkCallbackName = this.outputOptions.hotUpdateFunction || Template.toIdentifier("webpackHotUpdate" + (this.outputOptions.library || ""));
  12. const source = new ConcatSource();
  13. source.add(chunkCallbackName + "(" + JSON.stringify(id) + ",");
  14. source.add(modulesSource);
  15. source.add(")");
  16. return source;
  17. });
  18. hotUpdateChunkTemplate.plugin("hash", function(hash) {
  19. hash.update("WebWorkerHotUpdateChunkTemplatePlugin");
  20. hash.update("3");
  21. hash.update(this.outputOptions.hotUpdateFunction + "");
  22. hash.update(this.outputOptions.library + "");
  23. });
  24. }
  25. }
  26. module.exports = WebWorkerHotUpdateChunkTemplatePlugin;