I am an HTML / CSS / PHP / MYSQL programmer, now trying to learn some javascript. I do this by digging out the webmail code that I am currently using (open source) and trying to figure out how this works. I am trying to understand how different parts of the page load (without reloading the page you would get in PHP). If I'm not mistaken, use webpack for this. Each part of the page loads as a module, if I'm not mistaken.
/******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) /******/ return installedModules[moduleId].exports; /******/ /******/ // Create a new module (and put it into the cache) /******/ var module = 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 /******/ return module.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 = "webmail/v/0.0.0/static/js/"; /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(0); /******/ })
This seems to be (part of) the code that makes this magic possible. Now, later in the code, webpack is used as follows:
AbstractSystemDropDownUserView.prototype.settingsClick = function () { __webpack_require__( 5).setHash(Links.settings()); };
If I'm right, this function loads the module when I click on the button that I liked settingsClick. However, where are the module numbers / assigned?
Any help in getting me on my way is much appreciated!
javascript module webpack
Sander
source share