xuyingjie / fragment

Blog Tool
MIT License
1 stars 0 forks source link

Module #8

Open xuyingjie opened 8 years ago

xuyingjie commented 8 years ago

webpack for CommonJS

/******/ (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 = "";

/******/    // Load entry module and return exports
/******/    return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __webpack_require__) {

    var cal = __webpack_require__(1)

    var out = cal(3,4)
    console.log(out)

/***/ },
/* 1 */
/***/ function(module, exports) {

    var cal = function(a, b) {
        return a + b
    }
    module.exports = cal

/***/ }
/******/ ]);
xuyingjie commented 8 years ago

Electron's require

// require('./index.js')
(function (exports, require, module, __filename, __dirname, process, global) {

});