You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vara=require("./a");// get module idvaraId=require.resolve("./a.js");// clear module in require.cachedeleterequire.cache[aId];// require module again, it should be reexecutedvara2=require("./a");// vertify itif(a==a2)thrownewError("Cache clear failed :(");
a.js
module.exports=Math.random();
js/output.js
/******/(function(modules){// webpackBootstrap/******/// The module cache/******/varinstalledModules={};/******/// The require function/******/function__webpack_require__(moduleId){/******/// Check if module is in cache/******/if(installedModules[moduleId])/******/returninstalledModules[moduleId].exports;/******/// Create a new module (and put it into the cache)/******/varmodule=installedModules[moduleId]={/******/exports: {},/******/id: moduleId,/******/loaded: false/******/};/******/// Execute the module function/******/modules[moduleId].call(module.exports,module,module.exports,__webpack_require__);/******/// Flag the module as loaded/******/module.loaded=true;/******/// Return the exports of the module/******/returnmodule.exports;/******/}/******/// expose the modules object (__webpack_modules__)/******/__webpack_require__.m=modules;/******/// expose the module cache/******/__webpack_require__.c=installedModules;/******/// __webpack_public_path__/******/__webpack_require__.p="js/";/******/// Load entry module and return exports/******/return__webpack_require__(0);/******/})/************************************************************************//******/([/* 0 *//*!********************!*\ !*** ./example.js ***! \********************//***/function(module,exports,__webpack_require__){vara=__webpack_require__(/*! ./a */1);// get module idvaraId=/*require.resolve*/(/*! ./a.js */1);// clear module in require.cachedelete__webpack_require__.c[aId];// require module again, it should be reexecutedvara2=__webpack_require__(/*! ./a */1);// vertify itif(a==a2)thrownewError("Cache clear failed :(");/***/},/* 1 *//*!**************!*\ !*** ./a.js ***! \**************//***/function(module,exports){module.exports=Math.random();/***/}/******/]);