ChunkNameRuntimeModule.js 566 B

123456789101112131415161718192021222324252627
  1. /*
  2. MIT License http://www.opensource.org/licenses/mit-license.php
  3. */
  4. "use strict";
  5. const RuntimeGlobals = require("../RuntimeGlobals");
  6. const RuntimeModule = require("../RuntimeModule");
  7. class ChunkNameRuntimeModule extends RuntimeModule {
  8. /**
  9. * @param {string} chunkName the chunk's name
  10. */
  11. constructor(chunkName) {
  12. super("chunkName");
  13. this.chunkName = chunkName;
  14. }
  15. /**
  16. * @returns {string} runtime code
  17. */
  18. generate() {
  19. return `${RuntimeGlobals.chunkName} = ${JSON.stringify(this.chunkName)};`;
  20. }
  21. }
  22. module.exports = ChunkNameRuntimeModule;