Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

EvalSourceMapDevToolPlugin.js 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. Author Tobias Koppers @sokra
  4. */
  5. "use strict";
  6. const EvalSourceMapDevToolModuleTemplatePlugin = require("./EvalSourceMapDevToolModuleTemplatePlugin");
  7. const SourceMapDevToolModuleOptionsPlugin = require("./SourceMapDevToolModuleOptionsPlugin");
  8. class EvalSourceMapDevToolPlugin {
  9. constructor(options) {
  10. if (arguments.length > 1) {
  11. throw new Error(
  12. "EvalSourceMapDevToolPlugin only takes one argument (pass an options object)"
  13. );
  14. }
  15. if (typeof options === "string") {
  16. options = {
  17. append: options
  18. };
  19. }
  20. if (!options) options = {};
  21. this.options = options;
  22. }
  23. apply(compiler) {
  24. const options = this.options;
  25. compiler.hooks.compilation.tap(
  26. "EvalSourceMapDevToolPlugin",
  27. compilation => {
  28. new SourceMapDevToolModuleOptionsPlugin(options).apply(compilation);
  29. new EvalSourceMapDevToolModuleTemplatePlugin(
  30. compilation,
  31. options
  32. ).apply(compilation.moduleTemplates.javascript);
  33. }
  34. );
  35. }
  36. }
  37. module.exports = EvalSourceMapDevToolPlugin;