Last change
on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
685 bytes
|
Line | |
---|
1 | /*
|
---|
2 | MIT License http://www.opensource.org/licenses/mit-license.php
|
---|
3 | */
|
---|
4 |
|
---|
5 | "use strict";
|
---|
6 |
|
---|
7 | const RuntimeGlobals = require("../RuntimeGlobals");
|
---|
8 | const RuntimeModule = require("../RuntimeModule");
|
---|
9 |
|
---|
10 | class RuntimeIdRuntimeModule extends RuntimeModule {
|
---|
11 | constructor() {
|
---|
12 | super("runtimeId");
|
---|
13 | }
|
---|
14 |
|
---|
15 | /**
|
---|
16 | * @returns {string} runtime code
|
---|
17 | */
|
---|
18 | generate() {
|
---|
19 | const { chunkGraph, chunk } = this;
|
---|
20 | const runtime = chunk.runtime;
|
---|
21 | if (typeof runtime !== "string")
|
---|
22 | throw new Error("RuntimeIdRuntimeModule must be in a single runtime");
|
---|
23 | const id = chunkGraph.getRuntimeId(runtime);
|
---|
24 | return `${RuntimeGlobals.runtimeId} = ${JSON.stringify(id)};`;
|
---|
25 | }
|
---|
26 | }
|
---|
27 |
|
---|
28 | module.exports = RuntimeIdRuntimeModule;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.