MCPcopy
hub / github.com/webpack/webpack / __webpack_require_module__

Method __webpack_require_module__

lib/Compilation.js:6106–6155  ·  view source on GitHub ↗
(
												moduleArgument,
												id
											)

Source from the content-addressed store, hash-verified

6104 * @returns {ExecuteModuleExports} exports
6105 */
6106 const __webpack_require_module__ = (
6107 moduleArgument,
6108 id
6109 ) => {
6110 /** @type {ExecuteOptions} */
6111 const execOptions = {
6112 id,
6113 module: {
6114 id,
6115 exports: {},
6116 loaded: false,
6117 error: undefined
6118 },
6119 require: __webpack_require__
6120 };
6121 for (const handler of interceptModuleExecution) {
6122 handler(execOptions);
6123 }
6124 const module = moduleArgument.module;
6125 this.buildTimeExecutedModules.add(module);
6126 const moduleObject = execOptions.module;
6127 moduleArgument.moduleObject = moduleObject;
6128 try {
6129 if (id) moduleCache[id] = moduleObject;
6130
6131 tryRunOrWebpackError(
6132 () =>
6133 this.hooks.executeModule.call(
6134 moduleArgument,
6135 context
6136 ),
6137 "Compilation.hooks.executeModule"
6138 );
6139 moduleObject.loaded = true;
6140 return moduleObject.exports;
6141 } catch (execErr) {
6142 if (strictModuleExceptionHandling) {
6143 if (id) delete moduleCache[id];
6144 } else if (strictModuleErrorHandling) {
6145 moduleObject.error =
6146 /** @type {WebpackError} */
6147 (execErr);
6148 }
6149 if (!(/** @type {WebpackError} */ (execErr).module)) {
6150 /** @type {WebpackError} */
6151 (execErr).module = module;
6152 }
6153 throw execErr;
6154 }
6155 };
6156
6157 for (const runtimeModule of chunkGraph.getChunkRuntimeModulesInOrder(
6158 chunk

Callers

nothing calls this directly

Calls 4

tryRunOrWebpackErrorFunction · 0.85
handlerFunction · 0.50
addMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected