* @param {ModuleId} id module id * @param {RuntimeTemplate} runtimeTemplate runtime template * @returns {string} source for empty async context
(id, runtimeTemplate)
| 1263 | * @returns {string} source for empty async context |
| 1264 | */ |
| 1265 | getSourceForEmptyAsyncContext(id, runtimeTemplate) { |
| 1266 | return `function webpackEmptyAsyncContext(req) { |
| 1267 | // Here Promise.resolve().then() is used instead of new Promise() to prevent |
| 1268 | // uncaught exception popping up in devtools |
| 1269 | return Promise.resolve().then(${runtimeTemplate.basicFunction("", [ |
| 1270 | `${runtimeTemplate.renderConst()} e = new Error("Cannot find module '" + req + "'");`, |
| 1271 | "e.code = 'MODULE_NOT_FOUND';", |
| 1272 | "throw e;" |
| 1273 | ])}); |
| 1274 | } |
| 1275 | webpackEmptyAsyncContext.keys = ${runtimeTemplate.returningFunction("[]")}; |
| 1276 | webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext; |
| 1277 | webpackEmptyAsyncContext.id = ${JSON.stringify(id)}; |
| 1278 | module.exports = webpackEmptyAsyncContext;`; |
| 1279 | } |
| 1280 | |
| 1281 | /** |
| 1282 | * @param {string} asyncMode module mode |
no test coverage detected