I'm an HTML/CSS/PHP/MYSQL programmer, now trying to learn some javascript. I'm doing that by digging trough the code of the webmail I'm currently using (open source) and trying to understand how it works. I'm trying to understand how the different parts of the page are getting loaded (without the page reload you would get in PHP). If I'm not wrong it's using webpack to do that. Every part of the page is loaded as a module if I'm not wrong.
/******/ (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 that magic possible. Now, later on in the code webpack is used like this:
AbstractSystemDropDownUserView.prototype.settingsClick = function ()
{
__webpack_require__(/*! Knoin/Knoin */ 5).setHash(Links.settings());
};
If I'm correct, this function loads a module when clicking on the button liked to settingsClick. However, where are the module numbers defined/assigned?
Any help with getting me on my way is greatly appreciated!