* Returns the expression. * @param {object} options options object * @param {Module | null} 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 i
({ module, chunkGraph, request, weak, runtimeRequirements })
| 670 | * @returns {string} the expression |
| 671 | */ |
| 672 | moduleRaw({ module, chunkGraph, request, weak, runtimeRequirements }) { |
| 673 | if (!module) { |
| 674 | return this.missingModule({ |
| 675 | request |
| 676 | }); |
| 677 | } |
| 678 | const moduleId = chunkGraph.getModuleId(module); |
| 679 | if (moduleId === null) { |
| 680 | if (weak) { |
| 681 | // only weak referenced modules don't get an id |
| 682 | // we can always emit an error emitting code here |
| 683 | return this.weakError({ |
| 684 | module, |
| 685 | chunkGraph, |
| 686 | request, |
| 687 | type: "expression" |
| 688 | }); |
| 689 | } |
| 690 | throw new Error( |
| 691 | `RuntimeTemplate.moduleId(): ${noModuleIdErrorMessage( |
| 692 | module, |
| 693 | chunkGraph |
| 694 | )}` |
| 695 | ); |
| 696 | } |
| 697 | runtimeRequirements.add(RuntimeGlobals.require); |
| 698 | return `${RuntimeGlobals.require}(${this.moduleId({ |
| 699 | module, |
| 700 | chunkGraph, |
| 701 | request, |
| 702 | weak |
| 703 | })})`; |
| 704 | } |
| 705 | |
| 706 | /** |
| 707 | * Returns the expression. |
no test coverage detected