source: imaps-frontend/node_modules/webpack/lib/runtime/MakeNamespaceObjectRuntimeModule.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 MIT License http://www.opensource.org/licenses/mit-license.php
3*/
4
5"use strict";
6
7const RuntimeGlobals = require("../RuntimeGlobals");
8const Template = require("../Template");
9const HelperRuntimeModule = require("./HelperRuntimeModule");
10
11/** @typedef {import("../Compilation")} Compilation */
12
13class MakeNamespaceObjectRuntimeModule extends HelperRuntimeModule {
14 constructor() {
15 super("make namespace object");
16 }
17
18 /**
19 * @returns {string | null} runtime code
20 */
21 generate() {
22 const compilation = /** @type {Compilation} */ (this.compilation);
23 const { runtimeTemplate } = compilation;
24 const fn = RuntimeGlobals.makeNamespaceObject;
25 return Template.asString([
26 "// define __esModule on exports",
27 `${fn} = ${runtimeTemplate.basicFunction("exports", [
28 "if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {",
29 Template.indent([
30 "Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });"
31 ]),
32 "}",
33 "Object.defineProperty(exports, '__esModule', { value: true });"
34 ])};`
35 ]);
36 }
37}
38
39module.exports = MakeNamespaceObjectRuntimeModule;
Note: See TracBrowser for help on using the repository browser.