* Returns the expression. * @param {object} options options object * @param {Module} options.module the module * @param {ChunkGraph} options.chunkGraph the chunk graph * @param {string=} options.request the request that should be printed as comment * @param {boolean=} options.weak if the d
({ module, chunkGraph, request, weak })
| 639 | * @returns {string} the expression |
| 640 | */ |
| 641 | moduleId({ module, chunkGraph, request, weak }) { |
| 642 | if (!module) { |
| 643 | return this.missingModule({ |
| 644 | request |
| 645 | }); |
| 646 | } |
| 647 | const moduleId = chunkGraph.getModuleId(module); |
| 648 | if (moduleId === null) { |
| 649 | if (weak) { |
| 650 | return "null /* weak dependency, without id */"; |
| 651 | } |
| 652 | throw new Error( |
| 653 | `RuntimeTemplate.moduleId(): ${noModuleIdErrorMessage( |
| 654 | module, |
| 655 | chunkGraph |
| 656 | )}` |
| 657 | ); |
| 658 | } |
| 659 | return `${this.comment({ request })}${JSON.stringify(moduleId)}`; |
| 660 | } |
| 661 | |
| 662 | /** |
| 663 | * Returns the expression. |
no test coverage detected