Skip to content

Instantly share code, notes, and snippets.

@amannn
Last active October 30, 2020 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amannn/998ddbd6f1924c50d21d9450c2aa45ff to your computer and use it in GitHub Desktop.
Save amannn/998ddbd6f1924c50d21d9450c2aa45ff to your computer and use it in GitHub Desktop.
webpack top-level await es5
/******/ (function () {
// webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = {
/***/ /*! runtime requirements: __webpack_require__, module */
/*! ModuleConcatenation bailout: Module is async */
30:
/*!***************************!*\\
!*** ./topLevelAwait1.js ***!
\\***************************/
/*! namespace exports */ /***/ function (
module,
__unused_webpack___webpack_exports__,
__webpack_require__
) {
module.exports = (async () => {
/* harmony import */ var _topLevelAwait2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
/*! ./topLevelAwait2 */ 523
);
_topLevelAwait2__WEBPACK_IMPORTED_MODULE_0__ = await Promise.resolve(
_topLevelAwait2__WEBPACK_IMPORTED_MODULE_0__
);
console.log(
_topLevelAwait2__WEBPACK_IMPORTED_MODULE_0__ /* .default */.Z
);
})();
/***/
},
/**
* @param module
* @param __webpack_exports__
*/ 523:
/*!***************************!*\\
!*** ./topLevelAwait2.js ***!
\\***************************/
/*! namespace exports */
/*! export default [provided] [used in main] [renamed to Z] */
/*! runtime requirements: __webpack_exports__, module */
/*! ModuleConcatenation bailout: Module is async */
/***/ function (module, __webpack_exports__) {
module.exports = (async () => {
/* harmony default export */ __webpack_exports__[
"Z"
] = await Promise.resolve(1);
return __webpack_exports__;
})();
/***/
}
/******/
}; // The module cache
/************************************************************************/
/******/ /******/ var __webpack_module_cache__ = {}; // The require function
/******/
/******/ /**
* @param moduleId
*/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if (__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/
} // Create a new module (and put it into the cache)
/******/ /******/ var module = (__webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/
}); // Execute the module function
/******/
/******/ /******/ __webpack_modules__[moduleId](
module,
module.exports,
__webpack_require__
); // Return the exports of the module
/******/
/******/ /******/ return module.exports;
/******/
} // startup // Load entry module
/******/
/************************************************************************/
/******/ /******/ /******/ __webpack_require__(30);
/******/ // This entry module used 'module' so it can't be inlined
/******/
})();
/******/ (function () {
// webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = {
/***/ /*! runtime requirements: __webpack_require__, module */
/*! ModuleConcatenation bailout: Module is async */
30:
/*!***************************!*\\
!*** ./topLevelAwait1.js ***!
\\***************************/
/*! namespace exports */ /***/ function (
module,
__unused_webpack___webpack_exports__,
__webpack_require__
) {
module.exports = (function () {
/* harmony import */ var _topLevelAwait2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(
/*! ./topLevelAwait2 */ 523
);
Promise.resolve(
_topLevelAwait2__WEBPACK_IMPORTED_MODULE_0__ /* .default */.Z
).then(function (Z) {
console.log(Z);
});
})();
/***/
},
/**
* @param module
* @param __webpack_exports__
*/ 523:
/*!***************************!*\\
!*** ./topLevelAwait2.js ***!
\\***************************/
/*! namespace exports */
/*! export default [provided] [used in main] [renamed to Z] */
/*! runtime requirements: __webpack_exports__, module */
/*! ModuleConcatenation bailout: Module is async */
/***/ function (module, __webpack_exports__) {
module.exports = (function () {
/* harmony default export */ __webpack_exports__[
"Z"
] = Promise.resolve(1);
return __webpack_exports__;
})();
/***/
}
/******/
}; // The module cache
/************************************************************************/
/******/ /******/ var __webpack_module_cache__ = {}; // The require function
/******/
/******/ /**
* @param moduleId
*/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ if (__webpack_module_cache__[moduleId]) {
/******/ return __webpack_module_cache__[moduleId].exports;
/******/
} // Create a new module (and put it into the cache)
/******/ /******/ var module = (__webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/
}); // Execute the module function
/******/
/******/ /******/ __webpack_modules__[moduleId](
module,
module.exports,
__webpack_require__
); // Return the exports of the module
/******/
/******/ /******/ return module.exports;
/******/
} // startup // Load entry module
/******/
/************************************************************************/
/******/ /******/ /******/ __webpack_require__(30);
/******/ // This entry module used 'module' so it can't be inlined
/******/
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment