国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 語言 > JavaScript > 正文

探索webpack模塊及webpack3新特性

2024-05-06 15:26:32
字體:
供稿:網(wǎng)友

本文從簡單的例子入手,從打包文件去分析以下三個(gè)問題:webpack打包文件是怎樣的?如何做到兼容各大模塊化方案的?webpack3帶來的新特性又是什么?

一個(gè)簡單的例子

webpack配置

 // webpack.config.jsmodule.exports = { entry: './src/index.js', output: { filename: 'bundle.js', path: path.resolve(__dirname, 'dist') },};

簡單的js文件

 // src/index.js console.log('hello world');

webpack打包后的代碼

一看你就會(huì)想,我就一行代碼,你給我打包那么多???(黑人問號(hào))

// dist/bundle.js /******/ (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] = {/******/    i: moduleId,/******/    l: false,/******/    exports: {}/******/   };/******//******/   // Execute the module function/******/   modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);/******//******/   // Flag the module as loaded/******/   module.l = 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;/******//******/  // define getter function for harmony exports/******/  __webpack_require__.d = function(exports, name, getter) {/******/   if(!__webpack_require__.o(exports, name)) {/******/    Object.defineProperty(exports, name, {/******/     configurable: false,/******/     enumerable: true,/******/     get: getter/******/    });/******/   }/******/  };/******//******/  // getDefaultExport function for compatibility with non-harmony modules/******/  __webpack_require__.n = function(module) {/******/   var getter = module && module.__esModule ?/******/    function getDefault() { return module['default']; } :/******/    function getModuleExports() { return module; };/******/   __webpack_require__.d(getter, 'a', getter);/******/   return getter;/******/  };/******//******/  // Object.prototype.hasOwnProperty.call/******/  __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };/******//******/  // __webpack_public_path__/******/  __webpack_require__.p = "";/******//******/  // Load entry module and return exports/******/  return __webpack_require__(__webpack_require__.s = 0);/******/ })/************************************************************************//******/ ([/* 0 *//***/ (function(module, exports) {console.log('hello world');/***/ })/******/ ]);            
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表

圖片精選

主站蜘蛛池模板: 叶城县| 遂平县| 蒙自县| 内黄县| 贵定县| 景宁| 德令哈市| 花莲市| 库车县| 周宁县| 黄石市| 沐川县| 怀来县| 瑞昌市| 安吉县| 锦州市| 济宁市| 红安县| 龙井市| 甘洛县| 砀山县| 成都市| 奈曼旗| 迁安市| 哈尔滨市| 吉隆县| 观塘区| 仙游县| 台州市| 襄樊市| 茌平县| 兴宁市| 梁河县| 卢湾区| 越西县| 大渡口区| 且末县| 宣威市| 醴陵市| 牡丹江市| 林州市|