(request, options, callback)
| 171 | * @returns {void} |
| 172 | */ |
| 173 | const importModule = (request, options, callback) => { |
| 174 | const dep = new LoaderImportDependency(request); |
| 175 | dep.loc = { |
| 176 | name: request |
| 177 | }; |
| 178 | const factory = compilation.dependencyFactories.get( |
| 179 | /** @type {DependencyConstructor} */ |
| 180 | (dep.constructor) |
| 181 | ); |
| 182 | if (factory === undefined) { |
| 183 | return callback( |
| 184 | new Error( |
| 185 | `No module factory available for dependency type: ${dep.constructor.name}` |
| 186 | ) |
| 187 | ); |
| 188 | } |
| 189 | |
| 190 | const oldFactorizeQueueContext = |
| 191 | compilation.factorizeQueue.getContext(); |
| 192 | compilation.factorizeQueue.setContext("import-module"); |
| 193 | const oldAddModuleQueueContext = |
| 194 | compilation.addModuleQueue.getContext(); |
| 195 | compilation.addModuleQueue.setContext("import-module"); |
| 196 | compilation.buildQueue.increaseParallelism(); |
| 197 | compilation.handleModuleCreation( |
| 198 | { |
| 199 | factory, |
| 200 | dependencies: [dep], |
| 201 | originModule: |
| 202 | /** @type {NormalModule} */ |
| 203 | (loaderContext._module), |
| 204 | contextInfo: { |
| 205 | issuerLayer: options.layer |
| 206 | }, |
| 207 | context: loaderContext.context, |
| 208 | connectOrigin: false, |
| 209 | checkCycle: true |
| 210 | }, |
| 211 | (err) => { |
| 212 | compilation.factorizeQueue.setContext(oldFactorizeQueueContext); |
| 213 | compilation.addModuleQueue.setContext(oldAddModuleQueueContext); |
| 214 | compilation.buildQueue.decreaseParallelism(); |
| 215 | if (err) { |
| 216 | return callback(err); |
| 217 | } |
| 218 | const referencedModule = moduleGraph.getModule(dep); |
| 219 | if (!referencedModule) { |
| 220 | return callback(new Error("Cannot load the module")); |
| 221 | } |
| 222 | compilation.buildQueue.increaseParallelism(); |
| 223 | compilation.executeModule( |
| 224 | referencedModule, |
| 225 | { |
| 226 | entryOptions: { |
| 227 | baseUri: options.baseUri, |
| 228 | publicPath: options.publicPath |
| 229 | } |
| 230 | }, |
nothing calls this directly
no test coverage detected