在我将 webpack 模块联合集成到我们的项目中之后,我仍然对此感到困惑。任何人都可以解释究竟是什么eager
意思?initialConsumes
还有和之间的关系是chunkMapping
什么?似乎当我设置为时eager
,true
应用程序将在导入模块之前等待所有chunkMapping
承诺完成initialConsumes
?很难理解所有这些......
var initialConsumes = ["webpack/sharing/consume/default/react/react?0106"];
/******/ initialConsumes.forEach((id) => {
/******/ __webpack_require__.m[id] = (module) => {
/******/ // Handle case when module is used sync
/******/ installedModules[id] = 0;
/******/ delete __webpack_require__.c[id];
/******/ var factory = moduleToHandlerMapping[id]();
/******/ if(typeof factory !== "function") throw new Error("Shared module is not available for eager consumption: " + id);
/******/ module.exports = factory();
/******/ }
/******/ });
/******/ var chunkMapping = {
/******/ "web_static_js_bootstrap_tsx-webpack_sharing_consume_default_react_react-webpack_sharing_consu-28c1dc": [
/******/ "webpack/sharing/consume/default/react/react?4218",
/******/ "webpack/sharing/consume/default/react-dom/react-dom",
/******/ "webpack/sharing/consume/default/react/react?f8d7",
/******/ "webpack/sharing/consume/default/react/react?6b37",
/******/ "webpack/sharing/consume/default/react/react?04cc",
/******/ "webpack/sharing/consume/default/react/react?f68a"
/******/ ]
/******/ };
另外,我为什么要在 期间关心远程模块initialConsumes
?
var promises = [];
/******/ switch(name) {
/******/ case "default": {
/******/ register("react-dom", "16.14.0", () => (() => (__webpack_require__(/*! ./node_modules/react-dom/index.js */ "./node_modules/react-dom/index.js"))), 1);
/******/ register("react", "16.14.0", () => (() => (__webpack_require__(/*! ./node_modules/react/index.js */ "./node_modules/react/index.js"))), 1);
/******/ initExternal("webpack/container/reference/mobileFederated");
/******/ }
/******/ break;
/******/ }
/******/ if(!promises.length) return initPromises[name] = 1;