[
  {
    "path": ".coding-ide/settings.json",
    "content": "{}"
  },
  {
    "path": ".gitignore",
    "content": "node_modules\nwebpack.sublime-project\nwebpack.sublime-workspace\n.history"
  },
  {
    "path": "LANGS.md",
    "content": "* [简体中文](zh-cn/)"
  },
  {
    "path": "README.md",
    "content": "# webpack指南\n\n<http://webpack.toobug.net>\n\n本指南由TooBug根据自己的理解和使用经验编写，初衷是为了方便国内的前端开发者更好地接触和使用webpack这个强大的前端打包工具。\n\n初次提交诞生于2015年10月20日，彼时webpack还是1.x，国内中文文档相当少，而官方英文文档也语焉不详，饱受诟病，故诞生此指南。\n\n然而由于个人精力方面的原因，本指南未能如期完成。时下webpack的资料已经遍地开花，随着webpack 2的发布，一方面官方文档也趋于完善，另一方面很多配置和用法已不再兼容，因此本指南的部分内容可能存在不准确的情况，请读者自行鉴别。\n\n另外，本指南有可能长期弃坑……"
  },
  {
    "path": "examples/chapter2/amd/bundle1.1.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function(){\n\t    alert('hello world!');\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter2/amd/bundle2.1.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t    __webpack_require__(1)\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function(example2){\n\t    example2.sayHello();\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ },\n/* 1 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [\n\t], __WEBPACK_AMD_DEFINE_RESULT__ = function(){\n\t    return {\n\t        sayHello:function(){\n\t            alert('hello world!');\n\t        }\n\t    };\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter2/amd/example1.1.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>webpack.toobug.net</title>\n\t<script src=\"./bundle1.1.js\"></script>\n</head>\n<body>\n\n</body>\n</html>"
  },
  {
    "path": "examples/chapter2/amd/example1.1.js",
    "content": "define([\n],function(){\n    alert('hello world!');\n});"
  },
  {
    "path": "examples/chapter2/amd/example2.1.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>webpack.toobug.net</title>\n\t<script src=\"./bundle2.1.js\"></script>\n</head>\n<body>\n\n</body>\n</html>"
  },
  {
    "path": "examples/chapter2/amd/example2.1.js",
    "content": "define([\n    './example2.2'\n],function(example2){\n    example2.sayHello();\n});"
  },
  {
    "path": "examples/chapter2/amd/example2.2.js",
    "content": "define([\n],function(){\n    return {\n        sayHello:function(){\n            alert('hello world!');\n        }\n    };\n});"
  },
  {
    "path": "examples/chapter2/commonjs/bundle1.1.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar example2 = __webpack_require__(1);\n\texample2.sayHello();\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tvar me = {\n\t    sayHello:function(){\n\t        alert('hello world!');\n\t    }\n\t};\n\n\tmodule.exports = me;\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter2/commonjs/example1.1.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>webpack.toobug.net</title>\n\t<script src=\"./bundle2.1.js\"></script>\n</head>\n<body>\n\n</body>\n</html>"
  },
  {
    "path": "examples/chapter2/commonjs/example1.1.js",
    "content": "var example2 = require('./example1.2');\nexample2.sayHello();"
  },
  {
    "path": "examples/chapter2/commonjs/example1.2.js",
    "content": "var me = {\n    sayHello:function(){\n        alert('hello world!');\n    }\n};\n\nmodule.exports = me;"
  },
  {
    "path": "examples/chapter2/node-modules-and-npm/example1/bundle1.1.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar url = __webpack_require__(1);\n\tvar result = url.parse('http://webpack.toobug.net/zh-cn/index.html');\n\tconsole.log(result);\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t// Copyright Joyent, Inc. and other Node contributors.\n\t//\n\t// Permission is hereby granted, free of charge, to any person obtaining a\n\t// copy of this software and associated documentation files (the\n\t// \"Software\"), to deal in the Software without restriction, including\n\t// without limitation the rights to use, copy, modify, merge, publish,\n\t// distribute, sublicense, and/or sell copies of the Software, and to permit\n\t// persons to whom the Software is furnished to do so, subject to the\n\t// following conditions:\n\t//\n\t// The above copyright notice and this permission notice shall be included\n\t// in all copies or substantial portions of the Software.\n\t//\n\t// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n\t// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\t// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n\t// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n\t// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n\t// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n\t// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\tvar punycode = __webpack_require__(2);\n\n\texports.parse = urlParse;\n\texports.resolve = urlResolve;\n\texports.resolveObject = urlResolveObject;\n\texports.format = urlFormat;\n\n\texports.Url = Url;\n\n\tfunction Url() {\n\t  this.protocol = null;\n\t  this.slashes = null;\n\t  this.auth = null;\n\t  this.host = null;\n\t  this.port = null;\n\t  this.hostname = null;\n\t  this.hash = null;\n\t  this.search = null;\n\t  this.query = null;\n\t  this.pathname = null;\n\t  this.path = null;\n\t  this.href = null;\n\t}\n\n\t// Reference: RFC 3986, RFC 1808, RFC 2396\n\n\t// define these here so at least they only have to be\n\t// compiled once on the first module load.\n\tvar protocolPattern = /^([a-z0-9.+-]+:)/i,\n\t    portPattern = /:[0-9]*$/,\n\n\t    // RFC 2396: characters reserved for delimiting URLs.\n\t    // We actually just auto-escape these.\n\t    delims = ['<', '>', '\"', '`', ' ', '\\r', '\\n', '\\t'],\n\n\t    // RFC 2396: characters not allowed for various reasons.\n\t    unwise = ['{', '}', '|', '\\\\', '^', '`'].concat(delims),\n\n\t    // Allowed by RFCs, but cause of XSS attacks.  Always escape these.\n\t    autoEscape = ['\\''].concat(unwise),\n\t    // Characters that are never ever allowed in a hostname.\n\t    // Note that any invalid chars are also handled, but these\n\t    // are the ones that are *expected* to be seen, so we fast-path\n\t    // them.\n\t    nonHostChars = ['%', '/', '?', ';', '#'].concat(autoEscape),\n\t    hostEndingChars = ['/', '?', '#'],\n\t    hostnameMaxLen = 255,\n\t    hostnamePartPattern = /^[a-z0-9A-Z_-]{0,63}$/,\n\t    hostnamePartStart = /^([a-z0-9A-Z_-]{0,63})(.*)$/,\n\t    // protocols that can allow \"unsafe\" and \"unwise\" chars.\n\t    unsafeProtocol = {\n\t      'javascript': true,\n\t      'javascript:': true\n\t    },\n\t    // protocols that never have a hostname.\n\t    hostlessProtocol = {\n\t      'javascript': true,\n\t      'javascript:': true\n\t    },\n\t    // protocols that always contain a // bit.\n\t    slashedProtocol = {\n\t      'http': true,\n\t      'https': true,\n\t      'ftp': true,\n\t      'gopher': true,\n\t      'file': true,\n\t      'http:': true,\n\t      'https:': true,\n\t      'ftp:': true,\n\t      'gopher:': true,\n\t      'file:': true\n\t    },\n\t    querystring = __webpack_require__(4);\n\n\tfunction urlParse(url, parseQueryString, slashesDenoteHost) {\n\t  if (url && isObject(url) && url instanceof Url) return url;\n\n\t  var u = new Url;\n\t  u.parse(url, parseQueryString, slashesDenoteHost);\n\t  return u;\n\t}\n\n\tUrl.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {\n\t  if (!isString(url)) {\n\t    throw new TypeError(\"Parameter 'url' must be a string, not \" + typeof url);\n\t  }\n\n\t  var rest = url;\n\n\t  // trim before proceeding.\n\t  // This is to support parse stuff like \"  http://foo.com  \\n\"\n\t  rest = rest.trim();\n\n\t  var proto = protocolPattern.exec(rest);\n\t  if (proto) {\n\t    proto = proto[0];\n\t    var lowerProto = proto.toLowerCase();\n\t    this.protocol = lowerProto;\n\t    rest = rest.substr(proto.length);\n\t  }\n\n\t  // figure out if it's got a host\n\t  // user@server is *always* interpreted as a hostname, and url\n\t  // resolution will treat //foo/bar as host=foo,path=bar because that's\n\t  // how the browser resolves relative URLs.\n\t  if (slashesDenoteHost || proto || rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)) {\n\t    var slashes = rest.substr(0, 2) === '//';\n\t    if (slashes && !(proto && hostlessProtocol[proto])) {\n\t      rest = rest.substr(2);\n\t      this.slashes = true;\n\t    }\n\t  }\n\n\t  if (!hostlessProtocol[proto] &&\n\t      (slashes || (proto && !slashedProtocol[proto]))) {\n\n\t    // there's a hostname.\n\t    // the first instance of /, ?, ;, or # ends the host.\n\t    //\n\t    // If there is an @ in the hostname, then non-host chars *are* allowed\n\t    // to the left of the last @ sign, unless some host-ending character\n\t    // comes *before* the @-sign.\n\t    // URLs are obnoxious.\n\t    //\n\t    // ex:\n\t    // http://a@b@c/ => user:a@b host:c\n\t    // http://a@b?@c => user:a host:c path:/?@c\n\n\t    // v0.12 TODO(isaacs): This is not quite how Chrome does things.\n\t    // Review our test case against browsers more comprehensively.\n\n\t    // find the first instance of any hostEndingChars\n\t    var hostEnd = -1;\n\t    for (var i = 0; i < hostEndingChars.length; i++) {\n\t      var hec = rest.indexOf(hostEndingChars[i]);\n\t      if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n\t        hostEnd = hec;\n\t    }\n\n\t    // at this point, either we have an explicit point where the\n\t    // auth portion cannot go past, or the last @ char is the decider.\n\t    var auth, atSign;\n\t    if (hostEnd === -1) {\n\t      // atSign can be anywhere.\n\t      atSign = rest.lastIndexOf('@');\n\t    } else {\n\t      // atSign must be in auth portion.\n\t      // http://a@b/c@d => host:b auth:a path:/c@d\n\t      atSign = rest.lastIndexOf('@', hostEnd);\n\t    }\n\n\t    // Now we have a portion which is definitely the auth.\n\t    // Pull that off.\n\t    if (atSign !== -1) {\n\t      auth = rest.slice(0, atSign);\n\t      rest = rest.slice(atSign + 1);\n\t      this.auth = decodeURIComponent(auth);\n\t    }\n\n\t    // the host is the remaining to the left of the first non-host char\n\t    hostEnd = -1;\n\t    for (var i = 0; i < nonHostChars.length; i++) {\n\t      var hec = rest.indexOf(nonHostChars[i]);\n\t      if (hec !== -1 && (hostEnd === -1 || hec < hostEnd))\n\t        hostEnd = hec;\n\t    }\n\t    // if we still have not hit it, then the entire thing is a host.\n\t    if (hostEnd === -1)\n\t      hostEnd = rest.length;\n\n\t    this.host = rest.slice(0, hostEnd);\n\t    rest = rest.slice(hostEnd);\n\n\t    // pull out port.\n\t    this.parseHost();\n\n\t    // we've indicated that there is a hostname,\n\t    // so even if it's empty, it has to be present.\n\t    this.hostname = this.hostname || '';\n\n\t    // if hostname begins with [ and ends with ]\n\t    // assume that it's an IPv6 address.\n\t    var ipv6Hostname = this.hostname[0] === '[' &&\n\t        this.hostname[this.hostname.length - 1] === ']';\n\n\t    // validate a little.\n\t    if (!ipv6Hostname) {\n\t      var hostparts = this.hostname.split(/\\./);\n\t      for (var i = 0, l = hostparts.length; i < l; i++) {\n\t        var part = hostparts[i];\n\t        if (!part) continue;\n\t        if (!part.match(hostnamePartPattern)) {\n\t          var newpart = '';\n\t          for (var j = 0, k = part.length; j < k; j++) {\n\t            if (part.charCodeAt(j) > 127) {\n\t              // we replace non-ASCII char with a temporary placeholder\n\t              // we need this to make sure size of hostname is not\n\t              // broken by replacing non-ASCII by nothing\n\t              newpart += 'x';\n\t            } else {\n\t              newpart += part[j];\n\t            }\n\t          }\n\t          // we test again with ASCII char only\n\t          if (!newpart.match(hostnamePartPattern)) {\n\t            var validParts = hostparts.slice(0, i);\n\t            var notHost = hostparts.slice(i + 1);\n\t            var bit = part.match(hostnamePartStart);\n\t            if (bit) {\n\t              validParts.push(bit[1]);\n\t              notHost.unshift(bit[2]);\n\t            }\n\t            if (notHost.length) {\n\t              rest = '/' + notHost.join('.') + rest;\n\t            }\n\t            this.hostname = validParts.join('.');\n\t            break;\n\t          }\n\t        }\n\t      }\n\t    }\n\n\t    if (this.hostname.length > hostnameMaxLen) {\n\t      this.hostname = '';\n\t    } else {\n\t      // hostnames are always lower case.\n\t      this.hostname = this.hostname.toLowerCase();\n\t    }\n\n\t    if (!ipv6Hostname) {\n\t      // IDNA Support: Returns a puny coded representation of \"domain\".\n\t      // It only converts the part of the domain name that\n\t      // has non ASCII characters. I.e. it dosent matter if\n\t      // you call it with a domain that already is in ASCII.\n\t      var domainArray = this.hostname.split('.');\n\t      var newOut = [];\n\t      for (var i = 0; i < domainArray.length; ++i) {\n\t        var s = domainArray[i];\n\t        newOut.push(s.match(/[^A-Za-z0-9_-]/) ?\n\t            'xn--' + punycode.encode(s) : s);\n\t      }\n\t      this.hostname = newOut.join('.');\n\t    }\n\n\t    var p = this.port ? ':' + this.port : '';\n\t    var h = this.hostname || '';\n\t    this.host = h + p;\n\t    this.href += this.host;\n\n\t    // strip [ and ] from the hostname\n\t    // the host field still retains them, though\n\t    if (ipv6Hostname) {\n\t      this.hostname = this.hostname.substr(1, this.hostname.length - 2);\n\t      if (rest[0] !== '/') {\n\t        rest = '/' + rest;\n\t      }\n\t    }\n\t  }\n\n\t  // now rest is set to the post-host stuff.\n\t  // chop off any delim chars.\n\t  if (!unsafeProtocol[lowerProto]) {\n\n\t    // First, make 100% sure that any \"autoEscape\" chars get\n\t    // escaped, even if encodeURIComponent doesn't think they\n\t    // need to be.\n\t    for (var i = 0, l = autoEscape.length; i < l; i++) {\n\t      var ae = autoEscape[i];\n\t      var esc = encodeURIComponent(ae);\n\t      if (esc === ae) {\n\t        esc = escape(ae);\n\t      }\n\t      rest = rest.split(ae).join(esc);\n\t    }\n\t  }\n\n\n\t  // chop off from the tail first.\n\t  var hash = rest.indexOf('#');\n\t  if (hash !== -1) {\n\t    // got a fragment string.\n\t    this.hash = rest.substr(hash);\n\t    rest = rest.slice(0, hash);\n\t  }\n\t  var qm = rest.indexOf('?');\n\t  if (qm !== -1) {\n\t    this.search = rest.substr(qm);\n\t    this.query = rest.substr(qm + 1);\n\t    if (parseQueryString) {\n\t      this.query = querystring.parse(this.query);\n\t    }\n\t    rest = rest.slice(0, qm);\n\t  } else if (parseQueryString) {\n\t    // no query string, but parseQueryString still requested\n\t    this.search = '';\n\t    this.query = {};\n\t  }\n\t  if (rest) this.pathname = rest;\n\t  if (slashedProtocol[lowerProto] &&\n\t      this.hostname && !this.pathname) {\n\t    this.pathname = '/';\n\t  }\n\n\t  //to support http.request\n\t  if (this.pathname || this.search) {\n\t    var p = this.pathname || '';\n\t    var s = this.search || '';\n\t    this.path = p + s;\n\t  }\n\n\t  // finally, reconstruct the href based on what has been validated.\n\t  this.href = this.format();\n\t  return this;\n\t};\n\n\t// format a parsed object into a url string\n\tfunction urlFormat(obj) {\n\t  // ensure it's an object, and not a string url.\n\t  // If it's an obj, this is a no-op.\n\t  // this way, you can call url_format() on strings\n\t  // to clean up potentially wonky urls.\n\t  if (isString(obj)) obj = urlParse(obj);\n\t  if (!(obj instanceof Url)) return Url.prototype.format.call(obj);\n\t  return obj.format();\n\t}\n\n\tUrl.prototype.format = function() {\n\t  var auth = this.auth || '';\n\t  if (auth) {\n\t    auth = encodeURIComponent(auth);\n\t    auth = auth.replace(/%3A/i, ':');\n\t    auth += '@';\n\t  }\n\n\t  var protocol = this.protocol || '',\n\t      pathname = this.pathname || '',\n\t      hash = this.hash || '',\n\t      host = false,\n\t      query = '';\n\n\t  if (this.host) {\n\t    host = auth + this.host;\n\t  } else if (this.hostname) {\n\t    host = auth + (this.hostname.indexOf(':') === -1 ?\n\t        this.hostname :\n\t        '[' + this.hostname + ']');\n\t    if (this.port) {\n\t      host += ':' + this.port;\n\t    }\n\t  }\n\n\t  if (this.query &&\n\t      isObject(this.query) &&\n\t      Object.keys(this.query).length) {\n\t    query = querystring.stringify(this.query);\n\t  }\n\n\t  var search = this.search || (query && ('?' + query)) || '';\n\n\t  if (protocol && protocol.substr(-1) !== ':') protocol += ':';\n\n\t  // only the slashedProtocols get the //.  Not mailto:, xmpp:, etc.\n\t  // unless they had them to begin with.\n\t  if (this.slashes ||\n\t      (!protocol || slashedProtocol[protocol]) && host !== false) {\n\t    host = '//' + (host || '');\n\t    if (pathname && pathname.charAt(0) !== '/') pathname = '/' + pathname;\n\t  } else if (!host) {\n\t    host = '';\n\t  }\n\n\t  if (hash && hash.charAt(0) !== '#') hash = '#' + hash;\n\t  if (search && search.charAt(0) !== '?') search = '?' + search;\n\n\t  pathname = pathname.replace(/[?#]/g, function(match) {\n\t    return encodeURIComponent(match);\n\t  });\n\t  search = search.replace('#', '%23');\n\n\t  return protocol + host + pathname + search + hash;\n\t};\n\n\tfunction urlResolve(source, relative) {\n\t  return urlParse(source, false, true).resolve(relative);\n\t}\n\n\tUrl.prototype.resolve = function(relative) {\n\t  return this.resolveObject(urlParse(relative, false, true)).format();\n\t};\n\n\tfunction urlResolveObject(source, relative) {\n\t  if (!source) return relative;\n\t  return urlParse(source, false, true).resolveObject(relative);\n\t}\n\n\tUrl.prototype.resolveObject = function(relative) {\n\t  if (isString(relative)) {\n\t    var rel = new Url();\n\t    rel.parse(relative, false, true);\n\t    relative = rel;\n\t  }\n\n\t  var result = new Url();\n\t  Object.keys(this).forEach(function(k) {\n\t    result[k] = this[k];\n\t  }, this);\n\n\t  // hash is always overridden, no matter what.\n\t  // even href=\"\" will remove it.\n\t  result.hash = relative.hash;\n\n\t  // if the relative url is empty, then there's nothing left to do here.\n\t  if (relative.href === '') {\n\t    result.href = result.format();\n\t    return result;\n\t  }\n\n\t  // hrefs like //foo/bar always cut to the protocol.\n\t  if (relative.slashes && !relative.protocol) {\n\t    // take everything except the protocol from relative\n\t    Object.keys(relative).forEach(function(k) {\n\t      if (k !== 'protocol')\n\t        result[k] = relative[k];\n\t    });\n\n\t    //urlParse appends trailing / to urls like http://www.example.com\n\t    if (slashedProtocol[result.protocol] &&\n\t        result.hostname && !result.pathname) {\n\t      result.path = result.pathname = '/';\n\t    }\n\n\t    result.href = result.format();\n\t    return result;\n\t  }\n\n\t  if (relative.protocol && relative.protocol !== result.protocol) {\n\t    // if it's a known url protocol, then changing\n\t    // the protocol does weird things\n\t    // first, if it's not file:, then we MUST have a host,\n\t    // and if there was a path\n\t    // to begin with, then we MUST have a path.\n\t    // if it is file:, then the host is dropped,\n\t    // because that's known to be hostless.\n\t    // anything else is assumed to be absolute.\n\t    if (!slashedProtocol[relative.protocol]) {\n\t      Object.keys(relative).forEach(function(k) {\n\t        result[k] = relative[k];\n\t      });\n\t      result.href = result.format();\n\t      return result;\n\t    }\n\n\t    result.protocol = relative.protocol;\n\t    if (!relative.host && !hostlessProtocol[relative.protocol]) {\n\t      var relPath = (relative.pathname || '').split('/');\n\t      while (relPath.length && !(relative.host = relPath.shift()));\n\t      if (!relative.host) relative.host = '';\n\t      if (!relative.hostname) relative.hostname = '';\n\t      if (relPath[0] !== '') relPath.unshift('');\n\t      if (relPath.length < 2) relPath.unshift('');\n\t      result.pathname = relPath.join('/');\n\t    } else {\n\t      result.pathname = relative.pathname;\n\t    }\n\t    result.search = relative.search;\n\t    result.query = relative.query;\n\t    result.host = relative.host || '';\n\t    result.auth = relative.auth;\n\t    result.hostname = relative.hostname || relative.host;\n\t    result.port = relative.port;\n\t    // to support http.request\n\t    if (result.pathname || result.search) {\n\t      var p = result.pathname || '';\n\t      var s = result.search || '';\n\t      result.path = p + s;\n\t    }\n\t    result.slashes = result.slashes || relative.slashes;\n\t    result.href = result.format();\n\t    return result;\n\t  }\n\n\t  var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'),\n\t      isRelAbs = (\n\t          relative.host ||\n\t          relative.pathname && relative.pathname.charAt(0) === '/'\n\t      ),\n\t      mustEndAbs = (isRelAbs || isSourceAbs ||\n\t                    (result.host && relative.pathname)),\n\t      removeAllDots = mustEndAbs,\n\t      srcPath = result.pathname && result.pathname.split('/') || [],\n\t      relPath = relative.pathname && relative.pathname.split('/') || [],\n\t      psychotic = result.protocol && !slashedProtocol[result.protocol];\n\n\t  // if the url is a non-slashed url, then relative\n\t  // links like ../.. should be able\n\t  // to crawl up to the hostname, as well.  This is strange.\n\t  // result.protocol has already been set by now.\n\t  // Later on, put the first path part into the host field.\n\t  if (psychotic) {\n\t    result.hostname = '';\n\t    result.port = null;\n\t    if (result.host) {\n\t      if (srcPath[0] === '') srcPath[0] = result.host;\n\t      else srcPath.unshift(result.host);\n\t    }\n\t    result.host = '';\n\t    if (relative.protocol) {\n\t      relative.hostname = null;\n\t      relative.port = null;\n\t      if (relative.host) {\n\t        if (relPath[0] === '') relPath[0] = relative.host;\n\t        else relPath.unshift(relative.host);\n\t      }\n\t      relative.host = null;\n\t    }\n\t    mustEndAbs = mustEndAbs && (relPath[0] === '' || srcPath[0] === '');\n\t  }\n\n\t  if (isRelAbs) {\n\t    // it's absolute.\n\t    result.host = (relative.host || relative.host === '') ?\n\t                  relative.host : result.host;\n\t    result.hostname = (relative.hostname || relative.hostname === '') ?\n\t                      relative.hostname : result.hostname;\n\t    result.search = relative.search;\n\t    result.query = relative.query;\n\t    srcPath = relPath;\n\t    // fall through to the dot-handling below.\n\t  } else if (relPath.length) {\n\t    // it's relative\n\t    // throw away the existing file, and take the new path instead.\n\t    if (!srcPath) srcPath = [];\n\t    srcPath.pop();\n\t    srcPath = srcPath.concat(relPath);\n\t    result.search = relative.search;\n\t    result.query = relative.query;\n\t  } else if (!isNullOrUndefined(relative.search)) {\n\t    // just pull out the search.\n\t    // like href='?foo'.\n\t    // Put this after the other two cases because it simplifies the booleans\n\t    if (psychotic) {\n\t      result.hostname = result.host = srcPath.shift();\n\t      //occationaly the auth can get stuck only in host\n\t      //this especialy happens in cases like\n\t      //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n\t      var authInHost = result.host && result.host.indexOf('@') > 0 ?\n\t                       result.host.split('@') : false;\n\t      if (authInHost) {\n\t        result.auth = authInHost.shift();\n\t        result.host = result.hostname = authInHost.shift();\n\t      }\n\t    }\n\t    result.search = relative.search;\n\t    result.query = relative.query;\n\t    //to support http.request\n\t    if (!isNull(result.pathname) || !isNull(result.search)) {\n\t      result.path = (result.pathname ? result.pathname : '') +\n\t                    (result.search ? result.search : '');\n\t    }\n\t    result.href = result.format();\n\t    return result;\n\t  }\n\n\t  if (!srcPath.length) {\n\t    // no path at all.  easy.\n\t    // we've already handled the other stuff above.\n\t    result.pathname = null;\n\t    //to support http.request\n\t    if (result.search) {\n\t      result.path = '/' + result.search;\n\t    } else {\n\t      result.path = null;\n\t    }\n\t    result.href = result.format();\n\t    return result;\n\t  }\n\n\t  // if a url ENDs in . or .., then it must get a trailing slash.\n\t  // however, if it ends in anything else non-slashy,\n\t  // then it must NOT get a trailing slash.\n\t  var last = srcPath.slice(-1)[0];\n\t  var hasTrailingSlash = (\n\t      (result.host || relative.host) && (last === '.' || last === '..') ||\n\t      last === '');\n\n\t  // strip single dots, resolve double dots to parent dir\n\t  // if the path tries to go above the root, `up` ends up > 0\n\t  var up = 0;\n\t  for (var i = srcPath.length; i >= 0; i--) {\n\t    last = srcPath[i];\n\t    if (last == '.') {\n\t      srcPath.splice(i, 1);\n\t    } else if (last === '..') {\n\t      srcPath.splice(i, 1);\n\t      up++;\n\t    } else if (up) {\n\t      srcPath.splice(i, 1);\n\t      up--;\n\t    }\n\t  }\n\n\t  // if the path is allowed to go above the root, restore leading ..s\n\t  if (!mustEndAbs && !removeAllDots) {\n\t    for (; up--; up) {\n\t      srcPath.unshift('..');\n\t    }\n\t  }\n\n\t  if (mustEndAbs && srcPath[0] !== '' &&\n\t      (!srcPath[0] || srcPath[0].charAt(0) !== '/')) {\n\t    srcPath.unshift('');\n\t  }\n\n\t  if (hasTrailingSlash && (srcPath.join('/').substr(-1) !== '/')) {\n\t    srcPath.push('');\n\t  }\n\n\t  var isAbsolute = srcPath[0] === '' ||\n\t      (srcPath[0] && srcPath[0].charAt(0) === '/');\n\n\t  // put the host back\n\t  if (psychotic) {\n\t    result.hostname = result.host = isAbsolute ? '' :\n\t                                    srcPath.length ? srcPath.shift() : '';\n\t    //occationaly the auth can get stuck only in host\n\t    //this especialy happens in cases like\n\t    //url.resolveObject('mailto:local1@domain1', 'local2@domain2')\n\t    var authInHost = result.host && result.host.indexOf('@') > 0 ?\n\t                     result.host.split('@') : false;\n\t    if (authInHost) {\n\t      result.auth = authInHost.shift();\n\t      result.host = result.hostname = authInHost.shift();\n\t    }\n\t  }\n\n\t  mustEndAbs = mustEndAbs || (result.host && srcPath.length);\n\n\t  if (mustEndAbs && !isAbsolute) {\n\t    srcPath.unshift('');\n\t  }\n\n\t  if (!srcPath.length) {\n\t    result.pathname = null;\n\t    result.path = null;\n\t  } else {\n\t    result.pathname = srcPath.join('/');\n\t  }\n\n\t  //to support request.http\n\t  if (!isNull(result.pathname) || !isNull(result.search)) {\n\t    result.path = (result.pathname ? result.pathname : '') +\n\t                  (result.search ? result.search : '');\n\t  }\n\t  result.auth = relative.auth || result.auth;\n\t  result.slashes = result.slashes || relative.slashes;\n\t  result.href = result.format();\n\t  return result;\n\t};\n\n\tUrl.prototype.parseHost = function() {\n\t  var host = this.host;\n\t  var port = portPattern.exec(host);\n\t  if (port) {\n\t    port = port[0];\n\t    if (port !== ':') {\n\t      this.port = port.substr(1);\n\t    }\n\t    host = host.substr(0, host.length - port.length);\n\t  }\n\t  if (host) this.hostname = host;\n\t};\n\n\tfunction isString(arg) {\n\t  return typeof arg === \"string\";\n\t}\n\n\tfunction isObject(arg) {\n\t  return typeof arg === 'object' && arg !== null;\n\t}\n\n\tfunction isNull(arg) {\n\t  return arg === null;\n\t}\n\tfunction isNullOrUndefined(arg) {\n\t  return  arg == null;\n\t}\n\n\n/***/ },\n/* 2 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module, global) {/*! https://mths.be/punycode v1.3.2 by @mathias */\n\t;(function(root) {\n\n\t\t/** Detect free variables */\n\t\tvar freeExports = typeof exports == 'object' && exports &&\n\t\t\t!exports.nodeType && exports;\n\t\tvar freeModule = typeof module == 'object' && module &&\n\t\t\t!module.nodeType && module;\n\t\tvar freeGlobal = typeof global == 'object' && global;\n\t\tif (\n\t\t\tfreeGlobal.global === freeGlobal ||\n\t\t\tfreeGlobal.window === freeGlobal ||\n\t\t\tfreeGlobal.self === freeGlobal\n\t\t) {\n\t\t\troot = freeGlobal;\n\t\t}\n\n\t\t/**\n\t\t * The `punycode` object.\n\t\t * @name punycode\n\t\t * @type Object\n\t\t */\n\t\tvar punycode,\n\n\t\t/** Highest positive signed 32-bit float value */\n\t\tmaxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1\n\n\t\t/** Bootstring parameters */\n\t\tbase = 36,\n\t\ttMin = 1,\n\t\ttMax = 26,\n\t\tskew = 38,\n\t\tdamp = 700,\n\t\tinitialBias = 72,\n\t\tinitialN = 128, // 0x80\n\t\tdelimiter = '-', // '\\x2D'\n\n\t\t/** Regular expressions */\n\t\tregexPunycode = /^xn--/,\n\t\tregexNonASCII = /[^\\x20-\\x7E]/, // unprintable ASCII chars + non-ASCII chars\n\t\tregexSeparators = /[\\x2E\\u3002\\uFF0E\\uFF61]/g, // RFC 3490 separators\n\n\t\t/** Error messages */\n\t\terrors = {\n\t\t\t'overflow': 'Overflow: input needs wider integers to process',\n\t\t\t'not-basic': 'Illegal input >= 0x80 (not a basic code point)',\n\t\t\t'invalid-input': 'Invalid input'\n\t\t},\n\n\t\t/** Convenience shortcuts */\n\t\tbaseMinusTMin = base - tMin,\n\t\tfloor = Math.floor,\n\t\tstringFromCharCode = String.fromCharCode,\n\n\t\t/** Temporary variable */\n\t\tkey;\n\n\t\t/*--------------------------------------------------------------------------*/\n\n\t\t/**\n\t\t * A generic error utility function.\n\t\t * @private\n\t\t * @param {String} type The error type.\n\t\t * @returns {Error} Throws a `RangeError` with the applicable error message.\n\t\t */\n\t\tfunction error(type) {\n\t\t\tthrow RangeError(errors[type]);\n\t\t}\n\n\t\t/**\n\t\t * A generic `Array#map` utility function.\n\t\t * @private\n\t\t * @param {Array} array The array to iterate over.\n\t\t * @param {Function} callback The function that gets called for every array\n\t\t * item.\n\t\t * @returns {Array} A new array of values returned by the callback function.\n\t\t */\n\t\tfunction map(array, fn) {\n\t\t\tvar length = array.length;\n\t\t\tvar result = [];\n\t\t\twhile (length--) {\n\t\t\t\tresult[length] = fn(array[length]);\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\n\t\t/**\n\t\t * A simple `Array#map`-like wrapper to work with domain name strings or email\n\t\t * addresses.\n\t\t * @private\n\t\t * @param {String} domain The domain name or email address.\n\t\t * @param {Function} callback The function that gets called for every\n\t\t * character.\n\t\t * @returns {Array} A new string of characters returned by the callback\n\t\t * function.\n\t\t */\n\t\tfunction mapDomain(string, fn) {\n\t\t\tvar parts = string.split('@');\n\t\t\tvar result = '';\n\t\t\tif (parts.length > 1) {\n\t\t\t\t// In email addresses, only the domain name should be punycoded. Leave\n\t\t\t\t// the local part (i.e. everything up to `@`) intact.\n\t\t\t\tresult = parts[0] + '@';\n\t\t\t\tstring = parts[1];\n\t\t\t}\n\t\t\t// Avoid `split(regex)` for IE8 compatibility. See #17.\n\t\t\tstring = string.replace(regexSeparators, '\\x2E');\n\t\t\tvar labels = string.split('.');\n\t\t\tvar encoded = map(labels, fn).join('.');\n\t\t\treturn result + encoded;\n\t\t}\n\n\t\t/**\n\t\t * Creates an array containing the numeric code points of each Unicode\n\t\t * character in the string. While JavaScript uses UCS-2 internally,\n\t\t * this function will convert a pair of surrogate halves (each of which\n\t\t * UCS-2 exposes as separate characters) into a single code point,\n\t\t * matching UTF-16.\n\t\t * @see `punycode.ucs2.encode`\n\t\t * @see <https://mathiasbynens.be/notes/javascript-encoding>\n\t\t * @memberOf punycode.ucs2\n\t\t * @name decode\n\t\t * @param {String} string The Unicode input string (UCS-2).\n\t\t * @returns {Array} The new array of code points.\n\t\t */\n\t\tfunction ucs2decode(string) {\n\t\t\tvar output = [],\n\t\t\t    counter = 0,\n\t\t\t    length = string.length,\n\t\t\t    value,\n\t\t\t    extra;\n\t\t\twhile (counter < length) {\n\t\t\t\tvalue = string.charCodeAt(counter++);\n\t\t\t\tif (value >= 0xD800 && value <= 0xDBFF && counter < length) {\n\t\t\t\t\t// high surrogate, and there is a next character\n\t\t\t\t\textra = string.charCodeAt(counter++);\n\t\t\t\t\tif ((extra & 0xFC00) == 0xDC00) { // low surrogate\n\t\t\t\t\t\toutput.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// unmatched surrogate; only append this code unit, in case the next\n\t\t\t\t\t\t// code unit is the high surrogate of a surrogate pair\n\t\t\t\t\t\toutput.push(value);\n\t\t\t\t\t\tcounter--;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\toutput.push(value);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn output;\n\t\t}\n\n\t\t/**\n\t\t * Creates a string based on an array of numeric code points.\n\t\t * @see `punycode.ucs2.decode`\n\t\t * @memberOf punycode.ucs2\n\t\t * @name encode\n\t\t * @param {Array} codePoints The array of numeric code points.\n\t\t * @returns {String} The new Unicode string (UCS-2).\n\t\t */\n\t\tfunction ucs2encode(array) {\n\t\t\treturn map(array, function(value) {\n\t\t\t\tvar output = '';\n\t\t\t\tif (value > 0xFFFF) {\n\t\t\t\t\tvalue -= 0x10000;\n\t\t\t\t\toutput += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);\n\t\t\t\t\tvalue = 0xDC00 | value & 0x3FF;\n\t\t\t\t}\n\t\t\t\toutput += stringFromCharCode(value);\n\t\t\t\treturn output;\n\t\t\t}).join('');\n\t\t}\n\n\t\t/**\n\t\t * Converts a basic code point into a digit/integer.\n\t\t * @see `digitToBasic()`\n\t\t * @private\n\t\t * @param {Number} codePoint The basic numeric code point value.\n\t\t * @returns {Number} The numeric value of a basic code point (for use in\n\t\t * representing integers) in the range `0` to `base - 1`, or `base` if\n\t\t * the code point does not represent a value.\n\t\t */\n\t\tfunction basicToDigit(codePoint) {\n\t\t\tif (codePoint - 48 < 10) {\n\t\t\t\treturn codePoint - 22;\n\t\t\t}\n\t\t\tif (codePoint - 65 < 26) {\n\t\t\t\treturn codePoint - 65;\n\t\t\t}\n\t\t\tif (codePoint - 97 < 26) {\n\t\t\t\treturn codePoint - 97;\n\t\t\t}\n\t\t\treturn base;\n\t\t}\n\n\t\t/**\n\t\t * Converts a digit/integer into a basic code point.\n\t\t * @see `basicToDigit()`\n\t\t * @private\n\t\t * @param {Number} digit The numeric value of a basic code point.\n\t\t * @returns {Number} The basic code point whose value (when used for\n\t\t * representing integers) is `digit`, which needs to be in the range\n\t\t * `0` to `base - 1`. If `flag` is non-zero, the uppercase form is\n\t\t * used; else, the lowercase form is used. The behavior is undefined\n\t\t * if `flag` is non-zero and `digit` has no uppercase form.\n\t\t */\n\t\tfunction digitToBasic(digit, flag) {\n\t\t\t//  0..25 map to ASCII a..z or A..Z\n\t\t\t// 26..35 map to ASCII 0..9\n\t\t\treturn digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);\n\t\t}\n\n\t\t/**\n\t\t * Bias adaptation function as per section 3.4 of RFC 3492.\n\t\t * http://tools.ietf.org/html/rfc3492#section-3.4\n\t\t * @private\n\t\t */\n\t\tfunction adapt(delta, numPoints, firstTime) {\n\t\t\tvar k = 0;\n\t\t\tdelta = firstTime ? floor(delta / damp) : delta >> 1;\n\t\t\tdelta += floor(delta / numPoints);\n\t\t\tfor (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {\n\t\t\t\tdelta = floor(delta / baseMinusTMin);\n\t\t\t}\n\t\t\treturn floor(k + (baseMinusTMin + 1) * delta / (delta + skew));\n\t\t}\n\n\t\t/**\n\t\t * Converts a Punycode string of ASCII-only symbols to a string of Unicode\n\t\t * symbols.\n\t\t * @memberOf punycode\n\t\t * @param {String} input The Punycode string of ASCII-only symbols.\n\t\t * @returns {String} The resulting string of Unicode symbols.\n\t\t */\n\t\tfunction decode(input) {\n\t\t\t// Don't use UCS-2\n\t\t\tvar output = [],\n\t\t\t    inputLength = input.length,\n\t\t\t    out,\n\t\t\t    i = 0,\n\t\t\t    n = initialN,\n\t\t\t    bias = initialBias,\n\t\t\t    basic,\n\t\t\t    j,\n\t\t\t    index,\n\t\t\t    oldi,\n\t\t\t    w,\n\t\t\t    k,\n\t\t\t    digit,\n\t\t\t    t,\n\t\t\t    /** Cached calculation results */\n\t\t\t    baseMinusT;\n\n\t\t\t// Handle the basic code points: let `basic` be the number of input code\n\t\t\t// points before the last delimiter, or `0` if there is none, then copy\n\t\t\t// the first basic code points to the output.\n\n\t\t\tbasic = input.lastIndexOf(delimiter);\n\t\t\tif (basic < 0) {\n\t\t\t\tbasic = 0;\n\t\t\t}\n\n\t\t\tfor (j = 0; j < basic; ++j) {\n\t\t\t\t// if it's not a basic code point\n\t\t\t\tif (input.charCodeAt(j) >= 0x80) {\n\t\t\t\t\terror('not-basic');\n\t\t\t\t}\n\t\t\t\toutput.push(input.charCodeAt(j));\n\t\t\t}\n\n\t\t\t// Main decoding loop: start just after the last delimiter if any basic code\n\t\t\t// points were copied; start at the beginning otherwise.\n\n\t\t\tfor (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {\n\n\t\t\t\t// `index` is the index of the next character to be consumed.\n\t\t\t\t// Decode a generalized variable-length integer into `delta`,\n\t\t\t\t// which gets added to `i`. The overflow checking is easier\n\t\t\t\t// if we increase `i` as we go, then subtract off its starting\n\t\t\t\t// value at the end to obtain `delta`.\n\t\t\t\tfor (oldi = i, w = 1, k = base; /* no condition */; k += base) {\n\n\t\t\t\t\tif (index >= inputLength) {\n\t\t\t\t\t\terror('invalid-input');\n\t\t\t\t\t}\n\n\t\t\t\t\tdigit = basicToDigit(input.charCodeAt(index++));\n\n\t\t\t\t\tif (digit >= base || digit > floor((maxInt - i) / w)) {\n\t\t\t\t\t\terror('overflow');\n\t\t\t\t\t}\n\n\t\t\t\t\ti += digit * w;\n\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\n\t\t\t\t\tif (digit < t) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\tif (w > floor(maxInt / baseMinusT)) {\n\t\t\t\t\t\terror('overflow');\n\t\t\t\t\t}\n\n\t\t\t\t\tw *= baseMinusT;\n\n\t\t\t\t}\n\n\t\t\t\tout = output.length + 1;\n\t\t\t\tbias = adapt(i - oldi, out, oldi == 0);\n\n\t\t\t\t// `i` was supposed to wrap around from `out` to `0`,\n\t\t\t\t// incrementing `n` each time, so we'll fix that now:\n\t\t\t\tif (floor(i / out) > maxInt - n) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tn += floor(i / out);\n\t\t\t\ti %= out;\n\n\t\t\t\t// Insert `n` at position `i` of the output\n\t\t\t\toutput.splice(i++, 0, n);\n\n\t\t\t}\n\n\t\t\treturn ucs2encode(output);\n\t\t}\n\n\t\t/**\n\t\t * Converts a string of Unicode symbols (e.g. a domain name label) to a\n\t\t * Punycode string of ASCII-only symbols.\n\t\t * @memberOf punycode\n\t\t * @param {String} input The string of Unicode symbols.\n\t\t * @returns {String} The resulting Punycode string of ASCII-only symbols.\n\t\t */\n\t\tfunction encode(input) {\n\t\t\tvar n,\n\t\t\t    delta,\n\t\t\t    handledCPCount,\n\t\t\t    basicLength,\n\t\t\t    bias,\n\t\t\t    j,\n\t\t\t    m,\n\t\t\t    q,\n\t\t\t    k,\n\t\t\t    t,\n\t\t\t    currentValue,\n\t\t\t    output = [],\n\t\t\t    /** `inputLength` will hold the number of code points in `input`. */\n\t\t\t    inputLength,\n\t\t\t    /** Cached calculation results */\n\t\t\t    handledCPCountPlusOne,\n\t\t\t    baseMinusT,\n\t\t\t    qMinusT;\n\n\t\t\t// Convert the input in UCS-2 to Unicode\n\t\t\tinput = ucs2decode(input);\n\n\t\t\t// Cache the length\n\t\t\tinputLength = input.length;\n\n\t\t\t// Initialize the state\n\t\t\tn = initialN;\n\t\t\tdelta = 0;\n\t\t\tbias = initialBias;\n\n\t\t\t// Handle the basic code points\n\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\tcurrentValue = input[j];\n\t\t\t\tif (currentValue < 0x80) {\n\t\t\t\t\toutput.push(stringFromCharCode(currentValue));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\thandledCPCount = basicLength = output.length;\n\n\t\t\t// `handledCPCount` is the number of code points that have been handled;\n\t\t\t// `basicLength` is the number of basic code points.\n\n\t\t\t// Finish the basic string - if it is not empty - with a delimiter\n\t\t\tif (basicLength) {\n\t\t\t\toutput.push(delimiter);\n\t\t\t}\n\n\t\t\t// Main encoding loop:\n\t\t\twhile (handledCPCount < inputLength) {\n\n\t\t\t\t// All non-basic code points < n have been handled already. Find the next\n\t\t\t\t// larger one:\n\t\t\t\tfor (m = maxInt, j = 0; j < inputLength; ++j) {\n\t\t\t\t\tcurrentValue = input[j];\n\t\t\t\t\tif (currentValue >= n && currentValue < m) {\n\t\t\t\t\t\tm = currentValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,\n\t\t\t\t// but guard against overflow\n\t\t\t\thandledCPCountPlusOne = handledCPCount + 1;\n\t\t\t\tif (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {\n\t\t\t\t\terror('overflow');\n\t\t\t\t}\n\n\t\t\t\tdelta += (m - n) * handledCPCountPlusOne;\n\t\t\t\tn = m;\n\n\t\t\t\tfor (j = 0; j < inputLength; ++j) {\n\t\t\t\t\tcurrentValue = input[j];\n\n\t\t\t\t\tif (currentValue < n && ++delta > maxInt) {\n\t\t\t\t\t\terror('overflow');\n\t\t\t\t\t}\n\n\t\t\t\t\tif (currentValue == n) {\n\t\t\t\t\t\t// Represent delta as a generalized variable-length integer\n\t\t\t\t\t\tfor (q = delta, k = base; /* no condition */; k += base) {\n\t\t\t\t\t\t\tt = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);\n\t\t\t\t\t\t\tif (q < t) {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tqMinusT = q - t;\n\t\t\t\t\t\t\tbaseMinusT = base - t;\n\t\t\t\t\t\t\toutput.push(\n\t\t\t\t\t\t\t\tstringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tq = floor(qMinusT / baseMinusT);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\toutput.push(stringFromCharCode(digitToBasic(q, 0)));\n\t\t\t\t\t\tbias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);\n\t\t\t\t\t\tdelta = 0;\n\t\t\t\t\t\t++handledCPCount;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t++delta;\n\t\t\t\t++n;\n\n\t\t\t}\n\t\t\treturn output.join('');\n\t\t}\n\n\t\t/**\n\t\t * Converts a Punycode string representing a domain name or an email address\n\t\t * to Unicode. Only the Punycoded parts of the input will be converted, i.e.\n\t\t * it doesn't matter if you call it on a string that has already been\n\t\t * converted to Unicode.\n\t\t * @memberOf punycode\n\t\t * @param {String} input The Punycoded domain name or email address to\n\t\t * convert to Unicode.\n\t\t * @returns {String} The Unicode representation of the given Punycode\n\t\t * string.\n\t\t */\n\t\tfunction toUnicode(input) {\n\t\t\treturn mapDomain(input, function(string) {\n\t\t\t\treturn regexPunycode.test(string)\n\t\t\t\t\t? decode(string.slice(4).toLowerCase())\n\t\t\t\t\t: string;\n\t\t\t});\n\t\t}\n\n\t\t/**\n\t\t * Converts a Unicode string representing a domain name or an email address to\n\t\t * Punycode. Only the non-ASCII parts of the domain name will be converted,\n\t\t * i.e. it doesn't matter if you call it with a domain that's already in\n\t\t * ASCII.\n\t\t * @memberOf punycode\n\t\t * @param {String} input The domain name or email address to convert, as a\n\t\t * Unicode string.\n\t\t * @returns {String} The Punycode representation of the given domain name or\n\t\t * email address.\n\t\t */\n\t\tfunction toASCII(input) {\n\t\t\treturn mapDomain(input, function(string) {\n\t\t\t\treturn regexNonASCII.test(string)\n\t\t\t\t\t? 'xn--' + encode(string)\n\t\t\t\t\t: string;\n\t\t\t});\n\t\t}\n\n\t\t/*--------------------------------------------------------------------------*/\n\n\t\t/** Define the public API */\n\t\tpunycode = {\n\t\t\t/**\n\t\t\t * A string representing the current Punycode.js version number.\n\t\t\t * @memberOf punycode\n\t\t\t * @type String\n\t\t\t */\n\t\t\t'version': '1.3.2',\n\t\t\t/**\n\t\t\t * An object of methods to convert from JavaScript's internal character\n\t\t\t * representation (UCS-2) to Unicode code points, and back.\n\t\t\t * @see <https://mathiasbynens.be/notes/javascript-encoding>\n\t\t\t * @memberOf punycode\n\t\t\t * @type Object\n\t\t\t */\n\t\t\t'ucs2': {\n\t\t\t\t'decode': ucs2decode,\n\t\t\t\t'encode': ucs2encode\n\t\t\t},\n\t\t\t'decode': decode,\n\t\t\t'encode': encode,\n\t\t\t'toASCII': toASCII,\n\t\t\t'toUnicode': toUnicode\n\t\t};\n\n\t\t/** Expose `punycode` */\n\t\t// Some AMD build optimizers, like r.js, check for specific condition patterns\n\t\t// like the following:\n\t\tif (\n\t\t\ttrue\n\t\t) {\n\t\t\t!(__WEBPACK_AMD_DEFINE_RESULT__ = function() {\n\t\t\t\treturn punycode;\n\t\t\t}.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t\t} else if (freeExports && freeModule) {\n\t\t\tif (module.exports == freeExports) { // in Node.js or RingoJS v0.8.0+\n\t\t\t\tfreeModule.exports = punycode;\n\t\t\t} else { // in Narwhal or RingoJS v0.7.0-\n\t\t\t\tfor (key in punycode) {\n\t\t\t\t\tpunycode.hasOwnProperty(key) && (freeExports[key] = punycode[key]);\n\t\t\t\t}\n\t\t\t}\n\t\t} else { // in Rhino or a web browser\n\t\t\troot.punycode = punycode;\n\t\t}\n\n\t}(this));\n\n\t/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)(module), (function() { return this; }())))\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\tmodule.exports = function(module) {\r\n\t\tif(!module.webpackPolyfill) {\r\n\t\t\tmodule.deprecate = function() {};\r\n\t\t\tmodule.paths = [];\r\n\t\t\t// module.parent = undefined by default\r\n\t\t\tmodule.children = [];\r\n\t\t\tmodule.webpackPolyfill = 1;\r\n\t\t}\r\n\t\treturn module;\r\n\t}\r\n\n\n/***/ },\n/* 4 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\n\texports.decode = exports.parse = __webpack_require__(5);\n\texports.encode = exports.stringify = __webpack_require__(6);\n\n\n/***/ },\n/* 5 */\n/***/ function(module, exports) {\n\n\t// Copyright Joyent, Inc. and other Node contributors.\n\t//\n\t// Permission is hereby granted, free of charge, to any person obtaining a\n\t// copy of this software and associated documentation files (the\n\t// \"Software\"), to deal in the Software without restriction, including\n\t// without limitation the rights to use, copy, modify, merge, publish,\n\t// distribute, sublicense, and/or sell copies of the Software, and to permit\n\t// persons to whom the Software is furnished to do so, subject to the\n\t// following conditions:\n\t//\n\t// The above copyright notice and this permission notice shall be included\n\t// in all copies or substantial portions of the Software.\n\t//\n\t// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n\t// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\t// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n\t// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n\t// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n\t// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n\t// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\t'use strict';\n\n\t// If obj.hasOwnProperty has been overridden, then calling\n\t// obj.hasOwnProperty(prop) will break.\n\t// See: https://github.com/joyent/node/issues/1707\n\tfunction hasOwnProperty(obj, prop) {\n\t  return Object.prototype.hasOwnProperty.call(obj, prop);\n\t}\n\n\tmodule.exports = function(qs, sep, eq, options) {\n\t  sep = sep || '&';\n\t  eq = eq || '=';\n\t  var obj = {};\n\n\t  if (typeof qs !== 'string' || qs.length === 0) {\n\t    return obj;\n\t  }\n\n\t  var regexp = /\\+/g;\n\t  qs = qs.split(sep);\n\n\t  var maxKeys = 1000;\n\t  if (options && typeof options.maxKeys === 'number') {\n\t    maxKeys = options.maxKeys;\n\t  }\n\n\t  var len = qs.length;\n\t  // maxKeys <= 0 means that we should not limit keys count\n\t  if (maxKeys > 0 && len > maxKeys) {\n\t    len = maxKeys;\n\t  }\n\n\t  for (var i = 0; i < len; ++i) {\n\t    var x = qs[i].replace(regexp, '%20'),\n\t        idx = x.indexOf(eq),\n\t        kstr, vstr, k, v;\n\n\t    if (idx >= 0) {\n\t      kstr = x.substr(0, idx);\n\t      vstr = x.substr(idx + 1);\n\t    } else {\n\t      kstr = x;\n\t      vstr = '';\n\t    }\n\n\t    k = decodeURIComponent(kstr);\n\t    v = decodeURIComponent(vstr);\n\n\t    if (!hasOwnProperty(obj, k)) {\n\t      obj[k] = v;\n\t    } else if (Array.isArray(obj[k])) {\n\t      obj[k].push(v);\n\t    } else {\n\t      obj[k] = [obj[k], v];\n\t    }\n\t  }\n\n\t  return obj;\n\t};\n\n\n/***/ },\n/* 6 */\n/***/ function(module, exports) {\n\n\t// Copyright Joyent, Inc. and other Node contributors.\n\t//\n\t// Permission is hereby granted, free of charge, to any person obtaining a\n\t// copy of this software and associated documentation files (the\n\t// \"Software\"), to deal in the Software without restriction, including\n\t// without limitation the rights to use, copy, modify, merge, publish,\n\t// distribute, sublicense, and/or sell copies of the Software, and to permit\n\t// persons to whom the Software is furnished to do so, subject to the\n\t// following conditions:\n\t//\n\t// The above copyright notice and this permission notice shall be included\n\t// in all copies or substantial portions of the Software.\n\t//\n\t// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n\t// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n\t// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n\t// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n\t// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n\t// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n\t// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\t'use strict';\n\n\tvar stringifyPrimitive = function(v) {\n\t  switch (typeof v) {\n\t    case 'string':\n\t      return v;\n\n\t    case 'boolean':\n\t      return v ? 'true' : 'false';\n\n\t    case 'number':\n\t      return isFinite(v) ? v : '';\n\n\t    default:\n\t      return '';\n\t  }\n\t};\n\n\tmodule.exports = function(obj, sep, eq, name) {\n\t  sep = sep || '&';\n\t  eq = eq || '=';\n\t  if (obj === null) {\n\t    obj = undefined;\n\t  }\n\n\t  if (typeof obj === 'object') {\n\t    return Object.keys(obj).map(function(k) {\n\t      var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;\n\t      if (Array.isArray(obj[k])) {\n\t        return obj[k].map(function(v) {\n\t          return ks + encodeURIComponent(stringifyPrimitive(v));\n\t        }).join(sep);\n\t      } else {\n\t        return ks + encodeURIComponent(stringifyPrimitive(obj[k]));\n\t      }\n\t    }).join(sep);\n\n\t  }\n\n\t  if (!name) return '';\n\t  return encodeURIComponent(stringifyPrimitive(name)) + eq +\n\t         encodeURIComponent(stringifyPrimitive(obj));\n\t};\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter2/node-modules-and-npm/example1/example1.1.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>webpack.toobug.net</title>\n\t<script src=\"./bundle1.1.js\"></script>\n</head>\n<body>\n\n</body>\n</html>"
  },
  {
    "path": "examples/chapter2/node-modules-and-npm/example1/example1.1.js",
    "content": "var url = require('url');\nvar result = url.parse('http://webpack.toobug.net/zh-cn/index.html');\nconsole.log(result);\n"
  },
  {
    "path": "examples/chapter2/node-modules-and-npm/example1/package.json",
    "content": "{\n  \"name\": \"example1\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\"\n}\n"
  },
  {
    "path": "examples/chapter2/node-modules-and-npm/example2/bundle2.1.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports) {\n\n\talert(typeof console);\n\tconsole.log('hello');\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter2/node-modules-and-npm/example2/example2.1.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>webpack.toobug.net</title>\n\t<script src=\"./bundle2.1.js\"></script>\n</head>\n<body>\n\n</body>\n</html>\n"
  },
  {
    "path": "examples/chapter2/node-modules-and-npm/example2/example2.1.js",
    "content": "alert(typeof console);\nconsole.log('hello');\n"
  },
  {
    "path": "examples/chapter2/node-modules-and-npm/example2/package.json",
    "content": "{\n  \"name\": \"example2\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\"\n}\n"
  },
  {
    "path": "examples/chapter2/non-moduler/bundle1.1.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports) {\n\n\talert('hello world');\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter2/non-moduler/example1.1.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>webpack.toobug.net</title>\n\t<script src=\"./bundle1.1.js\"></script>\n</head>\n<body>\n\n</body>\n</html>"
  },
  {
    "path": "examples/chapter2/non-moduler/example1.1.js",
    "content": "alert('hello world');"
  },
  {
    "path": "examples/chapter2/umd/bundle1.1.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory) {\n\t    if (true) {\n\t        // AMD. Register as an anonymous module.\n\t        !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t    } else if (typeof module === 'object' && module.exports) {\n\t        // Node. Does not work with strict CommonJS, but\n\t        // only CommonJS-like environments that support module.exports,\n\t        // like Node.\n\t        module.exports = factory();\n\t    } else {\n\t        // Browser globals (root is window)\n\t        root.returnExports = factory();\n\t    }\n\t}(this, function () {\n\t    // Just return a value to define the module export.\n\t    // This example returns an object, but the module\n\t    // can return a function as the exported value.\n\t    return {};\n\t}));\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter2/umd/bundle1.2.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports) {\n\n\t/*** IMPORTS FROM imports-loader ***/\n\tvar define = false;\n\n\t(function (root, factory) {\n\t    if (typeof define === 'function' && define.amd) {\n\t        // AMD. Register as an anonymous module.\n\t        define([], factory);\n\t    } else if (typeof module === 'object' && module.exports) {\n\t        // Node. Does not work with strict CommonJS, but\n\t        // only CommonJS-like environments that support module.exports,\n\t        // like Node.\n\t        module.exports = factory();\n\t    } else {\n\t        // Browser globals (root is window)\n\t        root.returnExports = factory();\n\t    }\n\t}(this, function () {\n\t    // Just return a value to define the module export.\n\t    // This example returns an object, but the module\n\t    // can return a function as the exported value.\n\t    return {};\n\t}));\n\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter2/umd/example1.1.js",
    "content": "(function (root, factory) {\n    if (typeof define === 'function' && define.amd) {\n        // AMD. Register as an anonymous module.\n        define([], factory);\n    } else if (typeof module === 'object' && module.exports) {\n        // Node. Does not work with strict CommonJS, but\n        // only CommonJS-like environments that support module.exports,\n        // like Node.\n        module.exports = factory();\n    } else {\n        // Browser globals (root is window)\n        root.returnExports = factory();\n    }\n}(this, function () {\n    // Just return a value to define the module export.\n    // This example returns an object, but the module\n    // can return a function as the exported value.\n    return {};\n}));\n"
  },
  {
    "path": "examples/chapter2/umd/package.json",
    "content": "{\n  \"name\": \"umd\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"bundle1.1.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"imports-loader\": \"^0.6.5\"\n  }\n}\n"
  },
  {
    "path": "examples/chapter3/chunks/example1/1.bundle.js",
    "content": "webpackJsonp([1],{\n\n/***/ 2:\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m b!');\n\t    }\n\t};\n\n/***/ }\n\n});"
  },
  {
    "path": "examples/chapter3/chunks/example1/2.bundle.js",
    "content": "webpackJsonp([2],{\n\n/***/ 3:\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m c!');\n\t    }\n\t};\n\n/***/ }\n\n});"
  },
  {
    "path": "examples/chapter3/chunks/example1/a.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m a!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/chunks/example1/b.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m b!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/chunks/example1/bundle.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// install a JSONP callback for chunk loading\n/******/ \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n/******/ \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules) {\n/******/ \t\t// add \"moreModules\" to the modules object,\n/******/ \t\t// then flag all \"chunkIds\" as loaded and fire callback\n/******/ \t\tvar moduleId, chunkId, i = 0, callbacks = [];\n/******/ \t\tfor(;i < chunkIds.length; i++) {\n/******/ \t\t\tchunkId = chunkIds[i];\n/******/ \t\t\tif(installedChunks[chunkId])\n/******/ \t\t\t\tcallbacks.push.apply(callbacks, installedChunks[chunkId]);\n/******/ \t\t\tinstalledChunks[chunkId] = 0;\n/******/ \t\t}\n/******/ \t\tfor(moduleId in moreModules) {\n/******/ \t\t\tmodules[moduleId] = moreModules[moduleId];\n/******/ \t\t}\n/******/ \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);\n/******/ \t\twhile(callbacks.length)\n/******/ \t\t\tcallbacks.shift().call(null, __webpack_require__);\n\n/******/ \t};\n\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// object to store loaded and loading chunks\n/******/ \t// \"0\" means \"already loaded\"\n/******/ \t// Array means \"loading\", array contains callbacks\n/******/ \tvar installedChunks = {\n/******/ \t\t0:0\n/******/ \t};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n/******/ \t// This file contains only the entry chunk.\n/******/ \t// The chunk loading function for additional chunks\n/******/ \t__webpack_require__.e = function requireEnsure(chunkId, callback) {\n/******/ \t\t// \"0\" is the signal for \"already loaded\"\n/******/ \t\tif(installedChunks[chunkId] === 0)\n/******/ \t\t\treturn callback.call(null, __webpack_require__);\n\n/******/ \t\t// an array means \"currently loading\".\n/******/ \t\tif(installedChunks[chunkId] !== undefined) {\n/******/ \t\t\tinstalledChunks[chunkId].push(callback);\n/******/ \t\t} else {\n/******/ \t\t\t// start chunk loading\n/******/ \t\t\tinstalledChunks[chunkId] = [callback];\n/******/ \t\t\tvar head = document.getElementsByTagName('head')[0];\n/******/ \t\t\tvar script = document.createElement('script');\n/******/ \t\t\tscript.type = 'text/javascript';\n/******/ \t\t\tscript.charset = 'utf-8';\n/******/ \t\t\tscript.async = true;\n\n/******/ \t\t\tscript.src = __webpack_require__.p + \"\" + chunkId + \".bundle.js\";\n/******/ \t\t\thead.appendChild(script);\n/******/ \t\t}\n/******/ \t};\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar a=__webpack_require__(1);\n\ta.sayHello();\n\n\t__webpack_require__.e/* nsure */(1, function(require){\n\t    var b = __webpack_require__(2);\n\t    b.sayHello(); \n\t});\n\n\t__webpack_require__.e/* require */(2, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(3)]; (function(c){\n\t    c.sayHello();\n\t}.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));});\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m a!');\n\t    }\n\t};\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/chunks/example1/c.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m c!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/chunks/example1/index.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>webpack.toobug.net</title>\n\t<script src=\"./bundle.js\"></script>\n</head>\n<body>\n\n</body>\n</html>\n"
  },
  {
    "path": "examples/chapter3/chunks/example1/main.js",
    "content": "var a=require('./a');\na.sayHello();\n\nrequire.ensure(['./b'], function(require){\n    var b = require('./b');\n    b.sayHello(); \n});\n\nrequire(['./c'], function(c){\n    c.sayHello();\n});\n"
  },
  {
    "path": "examples/chapter3/chunks/example2/1.bundle.1.js",
    "content": "webpackJsonp([1],{\n\n/***/ 2:\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m b!');\n\t    }\n\t};\n\n/***/ }\n\n});"
  },
  {
    "path": "examples/chapter3/chunks/example2/2.bundle.2.js",
    "content": "webpackJsonp([2],{\n\n/***/ 3:\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m c!');\n\t    }\n\t};\n\n/***/ }\n\n});"
  },
  {
    "path": "examples/chapter3/chunks/example2/a.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m a!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/chunks/example2/b.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m b!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/chunks/example2/bundle.main1.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// install a JSONP callback for chunk loading\n/******/ \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n/******/ \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules) {\n/******/ \t\t// add \"moreModules\" to the modules object,\n/******/ \t\t// then flag all \"chunkIds\" as loaded and fire callback\n/******/ \t\tvar moduleId, chunkId, i = 0, callbacks = [];\n/******/ \t\tfor(;i < chunkIds.length; i++) {\n/******/ \t\t\tchunkId = chunkIds[i];\n/******/ \t\t\tif(installedChunks[chunkId])\n/******/ \t\t\t\tcallbacks.push.apply(callbacks, installedChunks[chunkId]);\n/******/ \t\t\tinstalledChunks[chunkId] = 0;\n/******/ \t\t}\n/******/ \t\tfor(moduleId in moreModules) {\n/******/ \t\t\tmodules[moduleId] = moreModules[moduleId];\n/******/ \t\t}\n/******/ \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);\n/******/ \t\twhile(callbacks.length)\n/******/ \t\t\tcallbacks.shift().call(null, __webpack_require__);\n\n/******/ \t};\n\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// object to store loaded and loading chunks\n/******/ \t// \"0\" means \"already loaded\"\n/******/ \t// Array means \"loading\", array contains callbacks\n/******/ \tvar installedChunks = {\n/******/ \t\t0:0\n/******/ \t};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n/******/ \t// This file contains only the entry chunk.\n/******/ \t// The chunk loading function for additional chunks\n/******/ \t__webpack_require__.e = function requireEnsure(chunkId, callback) {\n/******/ \t\t// \"0\" is the signal for \"already loaded\"\n/******/ \t\tif(installedChunks[chunkId] === 0)\n/******/ \t\t\treturn callback.call(null, __webpack_require__);\n\n/******/ \t\t// an array means \"currently loading\".\n/******/ \t\tif(installedChunks[chunkId] !== undefined) {\n/******/ \t\t\tinstalledChunks[chunkId].push(callback);\n/******/ \t\t} else {\n/******/ \t\t\t// start chunk loading\n/******/ \t\t\tinstalledChunks[chunkId] = [callback];\n/******/ \t\t\tvar head = document.getElementsByTagName('head')[0];\n/******/ \t\t\tvar script = document.createElement('script');\n/******/ \t\t\tscript.type = 'text/javascript';\n/******/ \t\t\tscript.charset = 'utf-8';\n/******/ \t\t\tscript.async = true;\n\n/******/ \t\t\tscript.src = __webpack_require__.p + \"\" + chunkId + \".bundle.\" + ({}[chunkId]||chunkId) + \".js\";\n/******/ \t\t\thead.appendChild(script);\n/******/ \t\t}\n/******/ \t};\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar a=__webpack_require__(1);\n\ta.sayHello();\n\n\t__webpack_require__.e/* nsure */(1, function(require){\n\t    var b = __webpack_require__(2);\n\t    b.sayHello(); \n\t});\n\n\t__webpack_require__.e/* require */(2, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(3)]; (function(c){\n\t    c.sayHello();\n\t}.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));});\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m a!');\n\t    }\n\t};\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/chunks/example2/bundle.main2.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// install a JSONP callback for chunk loading\n/******/ \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n/******/ \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules) {\n/******/ \t\t// add \"moreModules\" to the modules object,\n/******/ \t\t// then flag all \"chunkIds\" as loaded and fire callback\n/******/ \t\tvar moduleId, chunkId, i = 0, callbacks = [];\n/******/ \t\tfor(;i < chunkIds.length; i++) {\n/******/ \t\t\tchunkId = chunkIds[i];\n/******/ \t\t\tif(installedChunks[chunkId])\n/******/ \t\t\t\tcallbacks.push.apply(callbacks, installedChunks[chunkId]);\n/******/ \t\t\tinstalledChunks[chunkId] = 0;\n/******/ \t\t}\n/******/ \t\tfor(moduleId in moreModules) {\n/******/ \t\t\tmodules[moduleId] = moreModules[moduleId];\n/******/ \t\t}\n/******/ \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);\n/******/ \t\twhile(callbacks.length)\n/******/ \t\t\tcallbacks.shift().call(null, __webpack_require__);\n\n/******/ \t};\n\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// object to store loaded and loading chunks\n/******/ \t// \"0\" means \"already loaded\"\n/******/ \t// Array means \"loading\", array contains callbacks\n/******/ \tvar installedChunks = {\n/******/ \t\t3:0\n/******/ \t};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n/******/ \t// This file contains only the entry chunk.\n/******/ \t// The chunk loading function for additional chunks\n/******/ \t__webpack_require__.e = function requireEnsure(chunkId, callback) {\n/******/ \t\t// \"0\" is the signal for \"already loaded\"\n/******/ \t\tif(installedChunks[chunkId] === 0)\n/******/ \t\t\treturn callback.call(null, __webpack_require__);\n\n/******/ \t\t// an array means \"currently loading\".\n/******/ \t\tif(installedChunks[chunkId] !== undefined) {\n/******/ \t\t\tinstalledChunks[chunkId].push(callback);\n/******/ \t\t} else {\n/******/ \t\t\t// start chunk loading\n/******/ \t\t\tinstalledChunks[chunkId] = [callback];\n/******/ \t\t\tvar head = document.getElementsByTagName('head')[0];\n/******/ \t\t\tvar script = document.createElement('script');\n/******/ \t\t\tscript.type = 'text/javascript';\n/******/ \t\t\tscript.charset = 'utf-8';\n/******/ \t\t\tscript.async = true;\n\n/******/ \t\t\tscript.src = __webpack_require__.p + \"\" + chunkId + \".bundle.\" + ({}[chunkId]||chunkId) + \".js\";\n/******/ \t\t\thead.appendChild(script);\n/******/ \t\t}\n/******/ \t};\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar a=__webpack_require__(1);\n\ta.sayHello();\n\n\t__webpack_require__.e/* nsure */(1/* duplicate */, function(require){\n\t    var b = __webpack_require__(2);\n\t    b.sayHello(); \n\t});\n\n\t__webpack_require__.e/* require */(2/* duplicate */, function(__webpack_require__) { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(3)]; (function(c){\n\t    c.sayHello();\n\t    console.log('hello2');\n\t}.apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__));});\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m a!');\n\t    }\n\t};\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/chunks/example2/c.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m c!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/chunks/example2/index.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>webpack.toobug.net</title>\n\t<script src=\"./bundle.js\"></script>\n</head>\n<body>\n\n</body>\n</html>\n"
  },
  {
    "path": "examples/chapter3/chunks/example2/main.2.js",
    "content": "var a=require('./a');\na.sayHello();\n\nrequire.ensure(['./b'], function(require){\n    var b = require('./b');\n    b.sayHello(); \n});\n\nrequire(['./c'], function(c){\n    c.sayHello();\n    console.log('hello2');\n});\n"
  },
  {
    "path": "examples/chapter3/chunks/example2/main.js",
    "content": "var a=require('./a');\na.sayHello();\n\nrequire.ensure(['./b'], function(require){\n    var b = require('./b');\n    b.sayHello(); \n});\n\nrequire(['./c'], function(c){\n    c.sayHello();\n});\n"
  },
  {
    "path": "examples/chapter3/chunks/example2/webpack.config.js",
    "content": "module.exports = {\n    entry:{\n        main1:'./main',\n        main2:'./main.2'\n    },\n    output:{\n        filename:'bundle.[name].js'\n    }\n};"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example1/a.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m a!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example1/b.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m b!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example1/bundle.main1.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar a=__webpack_require__(1);\n\ta.sayHello();\n\n\n\tvar b = __webpack_require__(2);\n\tb.sayHello(); \n\n\tvar c = __webpack_require__(3);\n\tc.sayHello();\n\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m a!');\n\t    }\n\t};\n\n/***/ },\n/* 2 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m b!');\n\t    }\n\t};\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m c!');\n\t    }\n\t};\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example1/bundle.main2.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar a=__webpack_require__(1);\n\ta.sayHello();\n\n\n\tvar b = __webpack_require__(2);\n\tb.sayHello(); \n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m a!');\n\t    }\n\t};\n\n/***/ },\n/* 2 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m b!');\n\t    }\n\t};\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example1/c.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m c!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example1/index.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>webpack.toobug.net</title>\n\t<script src=\"./bundle.js\"></script>\n</head>\n<body>\n\n</body>\n</html>\n"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example1/main.2.js",
    "content": "var a=require('./a');\na.sayHello();\n\n\nvar b = require('./b');\nb.sayHello(); \n"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example1/main.js",
    "content": "var a=require('./a');\na.sayHello();\n\n\nvar b = require('./b');\nb.sayHello(); \n\nvar c = require('./c');\nc.sayHello();\n\n"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example1/webpack.config.js",
    "content": "module.exports = {\n    entry:{\n        main1:'./main',\n        main2:'./main.2'\n    },\n    output:{\n        filename:'bundle.[name].js'\n    }\n};"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example2/a.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m a!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example2/b.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m b!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example2/bundle.main1.js",
    "content": "webpackJsonp([0],[\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar a=__webpack_require__(1);\n\ta.sayHello();\n\n\n\tvar b = __webpack_require__(2);\n\tb.sayHello(); \n\n\tvar c = __webpack_require__(3);\n\tc.sayHello();\n\n\n\n/***/ },\n/* 1 */,\n/* 2 */,\n/* 3 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m c!');\n\t    }\n\t};\n\n/***/ }\n]);"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example2/bundle.main2.js",
    "content": "webpackJsonp([1],[\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar a=__webpack_require__(1);\n\ta.sayHello();\n\n\n\tvar b = __webpack_require__(2);\n\tb.sayHello(); \n\n\n/***/ }\n]);"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example2/c.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m c!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example2/common.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// install a JSONP callback for chunk loading\n/******/ \tvar parentJsonpFunction = window[\"webpackJsonp\"];\n/******/ \twindow[\"webpackJsonp\"] = function webpackJsonpCallback(chunkIds, moreModules) {\n/******/ \t\t// add \"moreModules\" to the modules object,\n/******/ \t\t// then flag all \"chunkIds\" as loaded and fire callback\n/******/ \t\tvar moduleId, chunkId, i = 0, callbacks = [];\n/******/ \t\tfor(;i < chunkIds.length; i++) {\n/******/ \t\t\tchunkId = chunkIds[i];\n/******/ \t\t\tif(installedChunks[chunkId])\n/******/ \t\t\t\tcallbacks.push.apply(callbacks, installedChunks[chunkId]);\n/******/ \t\t\tinstalledChunks[chunkId] = 0;\n/******/ \t\t}\n/******/ \t\tfor(moduleId in moreModules) {\n/******/ \t\t\tmodules[moduleId] = moreModules[moduleId];\n/******/ \t\t}\n/******/ \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules);\n/******/ \t\twhile(callbacks.length)\n/******/ \t\t\tcallbacks.shift().call(null, __webpack_require__);\n/******/ \t\tif(moreModules[0]) {\n/******/ \t\t\tinstalledModules[0] = 0;\n/******/ \t\t\treturn __webpack_require__(0);\n/******/ \t\t}\n/******/ \t};\n\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// object to store loaded and loading chunks\n/******/ \t// \"0\" means \"already loaded\"\n/******/ \t// Array means \"loading\", array contains callbacks\n/******/ \tvar installedChunks = {\n/******/ \t\t2:0\n/******/ \t};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n/******/ \t// This file contains only the entry chunk.\n/******/ \t// The chunk loading function for additional chunks\n/******/ \t__webpack_require__.e = function requireEnsure(chunkId, callback) {\n/******/ \t\t// \"0\" is the signal for \"already loaded\"\n/******/ \t\tif(installedChunks[chunkId] === 0)\n/******/ \t\t\treturn callback.call(null, __webpack_require__);\n\n/******/ \t\t// an array means \"currently loading\".\n/******/ \t\tif(installedChunks[chunkId] !== undefined) {\n/******/ \t\t\tinstalledChunks[chunkId].push(callback);\n/******/ \t\t} else {\n/******/ \t\t\t// start chunk loading\n/******/ \t\t\tinstalledChunks[chunkId] = [callback];\n/******/ \t\t\tvar head = document.getElementsByTagName('head')[0];\n/******/ \t\t\tvar script = document.createElement('script');\n/******/ \t\t\tscript.type = 'text/javascript';\n/******/ \t\t\tscript.charset = 'utf-8';\n/******/ \t\t\tscript.async = true;\n\n/******/ \t\t\tscript.src = __webpack_require__.p + \"\" + chunkId + \".bundle.\" + ({\"0\":\"main1\",\"1\":\"main2\"}[chunkId]||chunkId) + \".js\";\n/******/ \t\t\thead.appendChild(script);\n/******/ \t\t}\n/******/ \t};\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */,\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m a!');\n\t    }\n\t};\n\n/***/ },\n/* 2 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m b!');\n\t    }\n\t};\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example2/index.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>webpack.toobug.net</title>\n\t<script src=\"./common.js\"></script>\n\t<script src=\"./bundle.main1.js\"></script>\n</head>\n<body>\n\n</body>\n</html>\n"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example2/main.2.js",
    "content": "var a=require('./a');\na.sayHello();\n\n\nvar b = require('./b');\nb.sayHello(); \n"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example2/main.js",
    "content": "var a=require('./a');\na.sayHello();\n\n\nvar b = require('./b');\nb.sayHello(); \n\nvar c = require('./c');\nc.sayHello();\n\n"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example2/package.json",
    "content": "{\n  \"name\": \"example2\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"main.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"webpack\": \"^1.12.8\"\n  }\n}\n"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example2/webpack.config.js",
    "content": "var webpack = require('webpack');\n\nmodule.exports = {\n    entry:{\n        main1:'./main',\n        main2:'./main.2'\n    },\n    output:{\n        filename:'bundle.[name].js'\n    },\n    plugins: [\n        new  webpack.optimize.CommonsChunkPlugin('common.js', ['main1', 'main2'])\n    ]\n};"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example3/a.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m a!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example3/b.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m b!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example3/bundle.main1.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar a=__webpack_require__(1);\n\ta.sayHello();\n\n\n\tvar b = __webpack_require__(2);\n\tb.sayHello(); \n\n\tvar c = __webpack_require__(3);\n\tc.sayHello();\n\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m a!');\n\t    }\n\t};\n\n/***/ },\n/* 2 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m b!');\n\t    }\n\t};\n\n/***/ },\n/* 3 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m c!');\n\t    }\n\t};\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example3/bundle.main2.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar a=__webpack_require__(1);\n\ta.sayHello();\n\n\n\tvar b = __webpack_require__(2);\n\tb.sayHello(); \n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m a!');\n\t    }\n\t};\n\n/***/ },\n/* 2 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        console.log('Hello World! I\\'m b!');\n\t    }\n\t};\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example3/c.js",
    "content": "module.exports = {\n    sayHello:function(){\n        console.log('Hello World! I\\'m c!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example3/index.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>webpack.toobug.net</title>\n\t<script src=\"./common.js\"></script>\n\t<script src=\"./bundle.main1.js\"></script>\n</head>\n<body>\n\n</body>\n</html>\n"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example3/main.2.js",
    "content": "var a=require('./a');\na.sayHello();\n\n\nvar b = require('./b');\nb.sayHello(); \n"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example3/main.js",
    "content": "var a=require('./a');\na.sayHello();\n\n\nvar b = require('./b');\nb.sayHello(); \n\nvar c = require('./c');\nc.sayHello();\n\n"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example3/package.json",
    "content": "{\n  \"name\": \"example2\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"main.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"webpack\": \"^1.12.8\"\n  }\n}\n"
  },
  {
    "path": "examples/chapter3/common-chunks-plugin/example3/webpack.config.js",
    "content": "var webpack = require('webpack');\n\nmodule.exports = {\n    entry:{\n        main1:'./main',\n        main2:'./main.2'\n    },\n    output:{\n        filename:'bundle.[name].js'\n    },\n    /*plugins: [\n        new  webpack.optimize.CommonsChunkPlugin({\n\t\tname:'main1',\n\t\tchunks: ['main1', 'main2'],\n\t\tasync:true\n\t})*/\n    ]\n};\n"
  },
  {
    "path": "examples/chapter3/config/example1/bundle1.1.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        alert('Hello World!');\n\t    }\n\t};\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/config/example1/example1.1.js",
    "content": "module.exports = {\n    sayHello:function(){\n        alert('Hello World!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/config/example1/webpack.config.js",
    "content": "module.exports = {\n    entry:'./example1.1',\n    output:{\n        filename:'bundle1.1.js'\n    }\n};"
  },
  {
    "path": "examples/chapter3/config/example2/00a87887166c6302d5c5.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t__webpack_require__(1);\n\tmodule.exports = __webpack_require__(2);\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        alert('Hello World!');\n\t    }\n\t};\n\n/***/ },\n/* 2 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        alert('Hello World!');\n\t    }\n\t};\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/config/example2/example2.1.js",
    "content": "module.exports = {\n    sayHello:function(){\n        alert('Hello World!');\n    }\n};"
  },
  {
    "path": "examples/chapter3/config/example2/example2.2.js",
    "content": "module.exports = {\n    sayHello:function(){\n        alert('Hello World!');\n    }\n};\n"
  },
  {
    "path": "examples/chapter3/config/example2/main.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t__webpack_require__(1);\n\tmodule.exports = __webpack_require__(2);\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        alert('Hello World!');\n\t    }\n\t};\n\n/***/ },\n/* 2 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        alert('Hello World!');\n\t    }\n\t};\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/config/example2/webpack.config.js",
    "content": "module.exports = {\n    entry:['./example2.1','./example2.2'],\n    output:{\n        //filename:'[name].js'\n        filename:'[hash].js'\n        //filename:'[chunkhash].js'\n    }\n};\n"
  },
  {
    "path": "examples/chapter3/config/example3/example3.1-6f17d6321f8580500bc9.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        alert('Hello World 3.1!');\n\t    }\n\t};\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/config/example3/example3.1-ef6b40ba3b9335fc2551.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        alert('Hello World 3.1!');\n\t    }\n\t};\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/config/example3/example3.1.js",
    "content": "module.exports = {\n    sayHello:function(){\n        alert('Hello World 3.1!');\n    }\n};\n"
  },
  {
    "path": "examples/chapter3/config/example3/example3.2-6f17d6321f8580500bc9.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        alert('Hello World 3.2!');\n\t    }\n\t};\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/config/example3/example3.2-b92fc07f9784897342c5.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        alert('Hello World 3.2!');\n\t    }\n\t};\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/config/example3/example3.2.js",
    "content": "module.exports = {\n    sayHello:function(){\n        alert('Hello World 3.2!');\n    }\n};\n"
  },
  {
    "path": "examples/chapter3/config/example3/main-d4f0fb1b36bb83969e77.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t(function webpackMissingModule() { throw new Error(\"Cannot find module \\\"./example2.1\\\"\"); }());\n\t(function webpackMissingModule() { throw new Error(\"Cannot find module \\\"./example2.2\\\"\"); }());\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/config/example3/webpack.config.js",
    "content": "module.exports = {\n    entry:{\n    \t'example3.1':'./example3.1',\n    \t'example3.2':'./example3.2'\n    },\n    output:{\n        //filename:'[name].js'\n        //filename:'[name]-[hash].js'\n        filename:'[name]-[chunkhash].js'\n    }\n};\n"
  },
  {
    "path": "examples/chapter3/config/example4/dist/example4.1.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        alert('Hello World 4.1!');\n\t    }\n\t};\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/config/example4/dist/hello/example4.2.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports) {\n\n\tmodule.exports = {\n\t    sayHello:function(){\n\t        alert('Hello World 4.3!');\n\t    }\n\t};\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter3/config/example4/src/example4.1.js",
    "content": "module.exports = {\n    sayHello:function(){\n        alert('Hello World 4.1!');\n    }\n};\n"
  },
  {
    "path": "examples/chapter3/config/example4/src/hello/example4.2.js",
    "content": "module.exports = {\n    sayHello:function(){\n        alert('Hello World 4.3!');\n    }\n};\n"
  },
  {
    "path": "examples/chapter3/config/example4/webpack.config.js",
    "content": "module.exports = {\n    entry:{\n    \t'example4.1':'./src/example4.1',\n    \t'hello/example4.2':'./src/hello/example4.2'\n    },\n    output:{\n        filename:'[name].js',\n        path:'./dist'\n    }\n};\n"
  },
  {
    "path": "examples/chapter4/exports-loader/example1/bundle1.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Hello = __webpack_require__(1);\n\n\tHello();\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\twindow.Hello = function(){\n\t\tconsole.log('hello from global Hello function');\n\t};\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter4/exports-loader/example1/bundle2.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar Hello = __webpack_require__(1);\n\n\tHello();\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\twindow.Hello = function(){\n\t\tconsole.log('hello from global Hello() function');\n\t};\n\n\n\t/*** EXPORTS FROM exports-loader ***/\n\tmodule.exports = Hello;\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter4/exports-loader/example1/example1.1.js",
    "content": "var Hello = require('./example1.2');\n\nHello();\n"
  },
  {
    "path": "examples/chapter4/exports-loader/example1/example1.2.js",
    "content": "window.Hello = function(){\n\tconsole.log('hello from global Hello() function');\n};\n"
  },
  {
    "path": "examples/chapter4/exports-loader/example1/index.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>webpack.toobug.net</title>\n\t<script src=\"./bundle2.js\"></script>\n</head>\n<body>\n\n</body>\n</html>\n"
  },
  {
    "path": "examples/chapter4/exports-loader/example1/package.json",
    "content": "{\n  \"name\": \"example1\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"dependencies\": {\n    \"exports-loader\": \"^0.6.3\"\n  }\n}\n"
  },
  {
    "path": "examples/chapter4/exports-loader/example1/webpack.config.js",
    "content": "module.exports = {\n\tmodule:{\n\t\tloaders:[\n\t\t\t{ test: require.resolve('./example1.2'), loader: \"exports?Hello\" }\n\t\t]\n\t}\n};\n"
  },
  {
    "path": "examples/chapter4/using-loaders/example1/bundle.js",
    "content": "/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n\n\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\tvar hello = __webpack_require__(1);\n\thello.sayHello();\n\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\tvar Hello;\n\n\tHello = (function() {\n\t  function Hello(name) {\n\t    this.name = name;\n\t  }\n\n\t  Hello.prototype.sayHello = function() {\n\t    return alert(\"hello \" + this.name);\n\t  };\n\n\t  return Hello;\n\n\t})();\n\n\tmodule.exports = new Hello('world');\n\n\n/***/ }\n/******/ ]);"
  },
  {
    "path": "examples/chapter4/using-loaders/example1/example1.1.js",
    "content": "var hello = require('coffee!./example1.2.coffee');\nhello.sayHello();\n"
  },
  {
    "path": "examples/chapter4/using-loaders/example1/example1.2.coffee",
    "content": "class Hello\n\tconstructor: (@name) ->\n\n\tsayHello: () ->\n\t\talert \"hello #{@name}\"\n\nmodule.exports = new Hello 'world'\n"
  },
  {
    "path": "examples/chapter4/using-loaders/example1/index.html",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n\t<title>webpack demo</title>\n</head>\n<body>\n\t<script src=\"./bundle.js\"></script>\n</body>\n</html>\n"
  },
  {
    "path": "examples/chapter4/using-loaders/example1/package.json",
    "content": "{\n  \"name\": \"example1\",\n  \"version\": \"1.0.0\",\n  \"description\": \"\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"test\": \"echo \\\"Error: no test specified\\\" && exit 1\"\n  },\n  \"author\": \"\",\n  \"license\": \"ISC\",\n  \"devDependencies\": {\n    \"coffee-loader\": \"^0.7.2\",\n    \"coffee-script\": \"^1.10.0\"\n  }\n}\n"
  },
  {
    "path": "notes",
    "content": "http://stackoverflow.com/questions/28969861/managing-jquery-plugin-dependency-in-webpack\nhttp://alexomara.com/blog/webpack-and-jquery-include-only-the-parts-you-need/ 加载jquery及按需打包\nhttp://jonathancreamer.com/advanced-webpack-part-1-the-commonschunk-plugin/ commonschunk插件"
  },
  {
    "path": "zh-cn/README.md",
    "content": "# webpack指南\n\n## webpack\n\nwebpack（<https://webpack.github.io/>）是一个用于web项目的模块打包工具。在大部分的使用场景中，我们将它看作是一个web前端模块打包工具。\n\n![webpack](https://webpack.github.io/assets/what-is-webpack.png)\n\n按照官方介绍，webpack可以将前端各种资源（包括CSS及其预编译方案、JS及其预编译方案）统一打包为`.js`文件和资源文件（图片）。\n\n## 关于本指南\n\n本指南由TooBug编写，所有章节内容均按自己的理解编写，初衷是为了方便国内的前端开发者更好地接触和使用webpack这个强大的前端打包工具。\n\n初次提交诞生于2015年10月20日，彼时webpack还是1.x，国内中文文档相当少，而官方英文文档也语焉不详，饱受诟病，故诞生此指南。\n\n然而由于个人精力方面的原因，本指南未能如期完成。时下webpack的资料已经遍地开花，随着webpack 2的发布，一方面官方文档也趋于完善，另一方面很多配置和用法已不再兼容，因此本指南的部分内容可能存在不准确的情况，请读者自行鉴别。\n\n另外，本指南有可能长期弃坑……\n\n联系方式：\n\n- 微博 [@TooBug](http://weibo.com/toooobug)\n- GitHub [@TooBug](https://github.com/TooBug)\n\n本书Github地址<https://github.com/TooBug/webpack-guide>，有任何意见和建议欢迎提出。"
  },
  {
    "path": "zh-cn/SUMMARY.md",
    "content": "# webpack指南\n\n* [第一章 模块化](chapter1/README.md)\n    * [原始时代](chapter1/ancient-times.md)\n    * [命名空间时代](chapter1/name-spacing-age.md)\n    * [模块化时代](chapter1/modular-age.md)\n* [第二章 webpack入门](chapter2/README.md)\n    * [入口文件](chapter2/entry-point.md)\n    * [非模块化文件打包](chapter2/non-moduler.md)\n    * [AMD模块打包](chapter2/amd.md)\n    * [CommonJS模块打包](chapter2/commonjs.md)\n    * [Node模块和NPM](chapter2/node-modules-and-npm.md)\n    * [UMD模块打包](chapter2/umd.md)\n* [第三章 webpack进阶](chapter3/README.md)\n    * [CLI与API使用模式](chapter3/cli-api.md)\n    * [基本配置项](chapter3/config.md)\n    * [分片](chapter3/chunks.md)\n    * [CommonChunks插件](chapter3/common-chunks-plugin.md)\n    * [SourceMap](chapter3/source-map.md)\n    * [高级配置项](chapter3/advanced-config.md)\n* [第四章 Loader](chapter4/README.md)\n    * [使用Loader](chapter4/using-loaders.md)\n    * [常用Loader](chapter4/loader-list.md)\n    * [bundle-loader](chapter4/bundle-loader.md)\n    * [exports-loader](chapter4/exports-loader.md)\n    * [imports-loader](chapter4/imports-loader.md)\n    * [expose-loader](chapter4/expose-loader.md)\n    * [非JS资源管理](chapter4/non-js-files.md)\n    * [生态圈](chapter4/eco-system.md)\n    * [Loader原理及编写](chapter4/loader-details.md)\n* [第五章 集成webpack](chapter5/README.md)\n    * [Gulp](chapter5/gulp.md)\n* [第六章 杂谈](chapter6/README.md)\n    * [jQuery的引入](chapter6/jquery.md)\n    * [TypeScript和Vue](chapter6/ts-and-vue.md)\n"
  },
  {
    "path": "zh-cn/chapter1/README.md",
    "content": "# 第一章 模块化\n\nTODO：模块化简介"
  },
  {
    "path": "zh-cn/chapter1/ancient-times.md",
    "content": "# 原始时代\n\n原始时代场景比较简单，较少碰到命名冲突和复杂依赖的场景，问题不突出。"
  },
  {
    "path": "zh-cn/chapter1/modular-age.md",
    "content": "# 模块化时代\n\n在忍受了命名空间一大串的名字很多年之后，终于有了模块化。促使模块化诞生的另一个因素是依赖管理的问题。\n\n## 限制\n\n浏览器对资源加载有同源策略限制，也不支持编程化加载资源。（支持加载，不告诉你加载结果，自己猜。）\n\n最终大部分加载器选择通过`<script>`标签加载，然后通过各种hack判断是否加载完成。\n\n## AMD\n\nrequire.js将AMD发扬光大，成为AMD事实标准。\n\n模块定义和使用：\n\n```javascript\ndefine(id?, dependencies?, function factory(){\n\n    return moduleContent;\n\n});\n```\n\n优点：浏览器直接使用。\n\n## Common.js / CMD\n\nCommon.js模块定义和使用：\n\n```javascript\nvar dependency = require('xxx');\n\n// 模块定义\nexports.xxx = xxx;\n\n// 或者\nmodule.exports = moduleContent;\n```\n\nCMD模块定义和使用：\n\n```javascript\ndefine(function(require, exports, module) {\n    var a = require('./a')\n    var b = require('./b') // 依赖可以就近书写\n})\n```\n\n## UMD\n\n```javascript\n(function (root, factory) {\n    if (typeof define === 'function' && define.amd) {\n        // AMD. Register as an anonymous module.\n        define(['b'], factory);\n    } else if (typeof module === 'object' && module.exports) {\n        // Node. Does not work with strict CommonJS, but\n        // only CommonJS-like environments that support module.exports,\n        // like Node.\n        module.exports = factory(require('b'));\n    } else {\n        // Browser globals (root is window)\n        root.returnExports = factory(root.b);\n    }\n}(this, function (b) {\n    //use b in some fashion.\n\n    // Just return a value to define the module export.\n    // This example returns an object, but the module\n    // can return a function as the exported value.\n    return {};\n}));\n```\n\n## 问题\n\n基于运行时，部分实现依赖于hack，没有可靠的基础，虽然有完善的测试，但还是会碰到意外情况。\n\n浏览器端限制多，导致hack多，配置项多。\n\n优化工具不够好用。\n\n无法复用生态圈，需要额外适配。\n\n"
  },
  {
    "path": "zh-cn/chapter1/name-spacing-age.md",
    "content": "# 命名空间时代\n\n复杂度增加之后，命名冲突的问题突显出来，出现了命名空间的模式，即一个Library只占用一个全局变量，所有内容都挂载在命名空间下。"
  },
  {
    "path": "zh-cn/chapter2/README.md",
    "content": "# 第二章 webpack入门\n\n与require.js / sea.js不同，webpack是一个在开发阶段进行打包的模块化工具，也就是说它无法不经过打包直接在线上使用。\n\nwebpack同时兼容AMD、Common.js以及非模块化的写法。注意这里的同时兼容可不是指你可以任选一种，而是……你可以同时用三种！\n\n当然你可能会说，谁他X同时用三种模块化方案？执念（就是神经病的意思）吧？\n\nYes，如果你是一个全新的项目，当然不应该如此规划，但如果是一个已经换了几拨人，跑了好多年的老项目，可能情况就没那么理想了。而这种情况下webpack也能比较从容的应对。简单说，适应性超强的。\n\n而webpack之所以好用，正是因为有诸如此类超出预期的特性，有可能你不需要，但如果你想要的时候就会爽得不要不要的。\n\nwebpack基于Node.js编写，在进入下文前，请确保已正确安装Node.js。后文中我们可能会使用全局安装的webpack或者gulp来完成打包，因此建议全局安装好webpack和gulp，后文不再解释。\n\n```sh\nnpm install -g webpack gulp\n```\n\n> 由于是全局安装，在Mac/Linux下，如果碰到`EACCES`错误，则可能需要在前面加`sudo`才能安装成功。\n> \n> 由于众所周知的原因，国内使用npm有时候不太顺利，可以考虑使用淘宝的镜像。\n>\n> ```npm install -g webpack gulp --registry=http://registry.npm.taobao.org```\n\n闲话不多说，咱们走着！"
  },
  {
    "path": "zh-cn/chapter2/amd.md",
    "content": "# AMD模块打包\n\n## 初试牛刀\n\nwebpack对AMD提供了比较完善的支持。我们同样以一个例子开始：\n\n`example1.1.html`：\n\n```html\n<html>\n<head>\n\t<title>webpack.toobug.net</title>\n\t<script src=\"./bundle1.1.js\"></script>\n</head>\n<body>\n</body>\n</html>\n```\n\n`example1.1.js`：\n\n```javascript\ndefine([\n],function(){\n    alert('hello world!');\n});\n```\n\n同样使用webpack进行编译，用法和前文使用的完全一样：\n\n```sh\nwebpack example1.1.js bundle1.1.js\n```\n\n同样打开HTML文件，同样弹出“hello world!”的弹窗。（这里就不截图了。）\n\n## 解析\n\n我们同样打开编译后的文件分析一下，请用力点击<https://github.com/TooBug/webpack-guide/blob/master/examples/chapter2/amd/bundle1.1.js>。\n\n可以看到，编译（就是打包的意思，后文可能会乱入，请习惯）后的文件有53行（非模块化的例子中是50行），结构仍然是一个Runtime + 模块数组，而且1到41行和前面非模块化的例子是完全一样的。\n\n第45行即第一个模块的包裹函数，与前面非模块化的例子相比，多了一个`__webpack_require__`参数（也就是前一节说的，如果有必要的话，还有`require`参数的意思）。如果在源文件中有使用`require`引用其它模块的话，那么使用`require`的地方经过编译之后都会变成`__webpack_require__`。关于这一点，后面会涉及到的时候会有更详细的论述，此处就不再深入。\n\n第45至52行之间即是模块本身了，当然也包含了包裹函数。如果智商正常的话，应该还是会觉得这个模块有点鬼斧神工吧？哦，也就是晦涩难懂的意思。我们稍微整理一下：\n\n```javascript\nfunction(module, exports, __webpack_require__) {\n\n\tvar __WEBPACK_AMD_DEFINE_ARRAY__, // AMD依赖列表\n\t\t__WEBPACK_AMD_DEFINE_RESULT__; // AMD factory函数的返回值，即模块内容\n\n\t__WEBPACK_AMD_DEFINE_ARRAY__ = [];\n\n\t// 执行factory函数，获取返回值作为模块内容\n\t// 函数体使用.apply调用，函数体中this为exports\n\t// 形参则分别对应依赖列表中的各个依赖模块\n\t__WEBPACK_AMD_DEFINE_RESULT__ = function(){\n\t    alert('hello world!');\n\t}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__);\n\n\t// 如果模块内容不为空，则通过module.exports返回\n\t// 如果为空，则不处理，在Runtime中声明为{}\n\tif(__WEBPACK_AMD_DEFINE_RESULT__ !== undefined){\n\t\tmodule.exports = __WEBPACK_AMD_DEFINE_RESULT__;\n\t}\n\n}\n```\n\n可以看到，尽管我们的例子中并没有声明什么依赖，但webpack还是为AMD模块做了很多准备工作，比如获取依赖模块内容并传给factory函数之类。主要逻辑在上面代码的例子中已经注释，就不再多解释。\n\n值得注意的是，在模块的最后，仍然是通过`module.exports`导出模块内容的，而Runtime中则不管是否AMD都完全一样。这种在不同模块化方案下打包后结构高度统一的方案为webpack带来了诸多好处，因为webpack只需要在模块入口导出这一块处理好不同模块化的差异即可，对后续的模块加载和优化等等都打下了坚实的基础。当然，目前可能还感觉不到这些好处，但是到目前为止，你应该可以非常直观地感觉到，webpack的确能同时支持多种模块化方案混合使用。\n\n> 为何webpack能同时使用多种模块化（及非模块化）方案的模块而传统的require.js / sea.js之类的方案则不行？这是因为webpack对模块的处理是在编译阶段，针对每一个模块都可以针对性地分析，然后对不同方案加以不同的包裹方案，最后生成可供浏览器运行的代码。而require.js之类的方案必须保证在运行时阶段能正确地引入模块并运行。\n> \n> 以require.js为例，在不做包裹的情况下，require.js完全无法感知非模块化JS文件的运行状态和结果，因此无法纳入其管理体系。\n> \n> 此外，require.js必须在全局定义`require`和`define`方法，而如果此时使用`<script>`引入使用UMD定义的模块，则无法正常工作，因为模块会认为当前是AMD环境，而AMD模块无法使用`<script>`直接引入。关于这一点，后续在讲解jQuery的时候会有详细说明。\n\n## AMD依赖\n\n在上一节中，我们并没有涉及到“依赖声明”这件事情，因为在非模块化的写法下，并不存在依赖声明这回事，如果文件B依赖文件A，则需要手工在HTML中引用A和B，而且必须保证A在B之前引入。\n\n而AMD的诞生初衷之一就是为了解决依赖声明，因此本例中我们也会涉及到依赖声明。\n\nHTML的文件和上例一样，不再重复。本例中的JS文件则变成了两个，一个入口文件`example2.1.js`，一个被依赖的模块`example2.2.js`。\n\n`example2.1.js`：\n\n```javascript\ndefine([\n    './example2.2'\n],function(example2){\n    example2.sayHello();\n});\n```\n\n`example2.2.js`：\n\n```javascript\ndefine([\n],function(){\n    return {\n        sayHello:function(){\n            alert('hello world!');\n        }\n    };\n});\n```\n\n同样使用webpack打包，只需要指定入口文件即可，webpack会处理处理好依赖：\n\n```sh\nwebpack example2.1.js bundle2.1.js\n```\n\n同样的打开HTML文件，同样的“hello world!”，同样的不再截图，也同样的，应该有一段解析。\n\n没错，看这里<https://github.com/TooBug/webpack-guide/blob/master/examples/chapter2/amd/bundle2.1.js>。\n\n同样的前41行是一样的。而这次模块列表数组的部分有了两个模块。这里终于可以说说我们之前一直刻意忽略的第44行了，在这个例子中相似的还有54行。这两行注释了一个数字，代表的是模块的索引，换个更专业的说法，则是（编译后的）“模块ID”。\n\n下面请集中注意力，我们要跳几行代码了。首先请看第1行，形参为`modules`，而我们前面已经说过，这个就是模块列表，也就是一个数组。再看第20行，从`modules`中访问了key为`moduleId`的模块，而由于`modules`为一个数组，所以这个`moduleId`自然就是数字了，正是数组的索引。\n\n特别值得注意的是第40行，`return __webpack_require__(0);`，如果留心的话会发现我们前面的例子中编译出来的这一行全部都是引用写死模块ID`0`，也就是说，**模块ID为0的永远是入口**。\n\n看完了Runtime之后我们再来看一下模块本身，模块ID为1的没什么好看的，和上面的例子一样，而模块ID为0的入口，和上例略有一点点不一样，即第48行。`__WEBPACK_AMD_DEFINE_ARRAY__`这个变量中使用`__webpack_require_(1)`引入了依赖，对应源文件`example2.1.js`，也即`example1.1.js`中声明的依赖。\n\n至此，我们已经完全清楚了AMD模块的依赖、factory函数在webpack中是如何处理的了。\n\n当然，如果你对AMD很熟悉的话，会发现我们漏掉了对`define`的第一个参数`moduleId`的讲解。由于AMD中模块ID与寻址直接相关，如果我们直接为模块指定一个模块ID的话，则默认情况下无法找到该依赖模块。这种情况下需要使用`resolve.alias`配置来解决。后文再详述。\n\n\n\n\n"
  },
  {
    "path": "zh-cn/chapter2/commonjs.md",
    "content": "# CommonJS模块打包\n\n经过前面非模块化和AMD打包的例子，本节我们就不再绕圈子，直接看例子。\n\nHTML代码和之前仍然是一样的，不再重复，JS文件如下：\n\n入口文件`example1.1.js`：\n\n```javascript\nvar example2 = require('./example1.2');\nexample2.sayHello();\n```\n\n被依赖的`example1.2.js`：\n\n```javascript\nvar me = {\n    sayHello:function(){\n        alert('hello world!');\n    }\n};\nmodule.exports = me;\n```\n\n同样使用webpack编译就能看到相同的弹窗。\n\n我们直接来看编译后的代码<https://github.com/TooBug/webpack-guide/blob/master/examples/chapter2/commonjs/bundle1.1.js>：\n\n呃。是不是惊呆了？前41行Runtime仍然长得那个鸟样，而后面的两个模块代码，几乎和我们编写时完全一样！！唯一的改动是`require`被替换成了`__webpack_require__`了。\n\n那就假装webpack是天然支持CommonJS的吧。所以通过这个例子也能感觉到，在使用webpack的项目中，使用CommonJS规范会省事很多。\n\n"
  },
  {
    "path": "zh-cn/chapter2/entry-point.md",
    "content": "## 入口文件\n\n为了方便，这里先解释一下入口文件的概念，这个概念在前端模块化中还是比较重要的，不管是用什么模块化规范，基本都绕不开这个概念。\n\n简单点说，入口文件就是在HTML直接引用的，由浏览器触发执行的JS文件。其它的非入口文件则是由入口文件来直接或间接依赖，由JS互相调用执行。举个简单的例子：\n\nindex.html:\n\n```html\n<html>\n\t<head>\n\t\t<script src=\"main.js\"></script>\n\t</head>\n\t<body>\n\t</body>\n</html>\n```\n\nmain.js\n\n```javascript\nvar a = require('./a');\nvar b = require('./b');\n\na.doSth();\nb.doSth();\n```\n\n这个例子中，`main.js`由HTML直接引用，是整个程序逻辑开始的地方，因此是入口文件，而被引用的`a`和`b`则是由`main.js`引入和调用，因此不是入口文件。\n\n一般而言，我们会将一些逻辑提取封装后放到独立的文件中，最后由入口文件引入来调用它们提供的方法完成整个程序逻辑。也就是一般入口文件关注整体流程，而非入口文件关注公共某一部分的实现。"
  },
  {
    "path": "zh-cn/chapter2/node-modules-and-npm.md",
    "content": "# Node和NPM\n\n咦，明明在说前端代码，怎么突然要说Node和NPM？等等，哪里有说我在说前端代码？明明说的是JS代码。\n\n好吧，前面的例子的确是在说前端代码，而且本指南全篇都将聚焦前端代码，但现在一个明显的趋势是前后端越来越趋向于融合，因此了解一些和Node/NPM的知识对于我们日常开发是有好处的。\n\n上面的都是大道理，具体的事实大致有这些：\n\n1. NPM已经不再是node package manager，而只是一个包管理软件，在NPM的愿景中是有前端代码这一块的\n2. 越来越多的前端库也选择将代码发布到npm，包括jQuery / Angular / react等\n3. 前端开发已经高度依赖于Node带来的生态端，比如各种各样的工具\n4. 由于CommonJS在前端开发中应用的成熟，复用Node的代码成为可能（且越来越方便）\n\n## 引用Node模块和NPM模块\n\n既然webpack支持在前端使用CommonJS模块规范，那么是否意味着我们可以直接使用NPM模块，甚至是Node内置的模块呢？答案是肯定的，我们看一个例子：\n\n首先准备同样的HTML和JS文件，不同的是，这次我们需要使用`npm init`准备一个`package.json`文件，因为安装npm依赖时需要用到。\n\n```sh\nnpm init\n```\n\n接下来一顿回车，就生成了一个`package.json`。然后安装一个npm模块`cookie`，用于解析和生成cookies串。\n\n```sh\nnpm install cookie --save\n```\n\n> `--save`会将依赖写入`package.json`，下次直接使用`npm install`即可安装依赖。\n\n接下来编写JS文件`example1.1.js`：\n\n```javascript\nvar url = require('url');\nvar urlResult = url.parse('http://webpack.toobug.net/zh-cn/index.html');\nconsole.log(urlResult);\n\nvar cookie = require('cookie');\nvar cookieResult = cookie.parse('name=toobug; subject=webpack;');\nconsole.log(cookieResult);\n```\n\n在这段代码里，我们分别使用Node内置的模块`url`和NPM中的模块`cookie`来解析字符串并输出结果。我们将这段JS分别在Node和浏览器中（经webpack编译）运行，最终输出如图：\n\n![Node](../images/chapter2/node-modules-and-npm/1.1.1.png)\n\nNode.js输出截图\n\n![浏览器](../images/chapter2/node-modules-and-npm/1.1.2.png)\n\n浏览器输出截图\n\n也就是说，我们可以直接在浏览器端复用Node和NPM的代码了！不知道此时的你是否会感到很兴奋？！这意味着我们的代码可以前后端复用了，而更重要的是，前端也可以使用NPM海量的模块了，就像上例中我们使用了`cookie`这个模块，我们手中的工具一下子变强大了好多倍！\n\n## Node模块和前端使用的CommonJS\n\nNode使用的模块规范也是CommonJS，所以理想情况下，是可以做到代码在Node和浏览器中复用的。但这里面有几处关键的差异可能导致无法复用：\n\n1. Node的模块在运行时会有一个包裹函数，下面详述\n2. 浏览器并不支持所有的Node模块，因此部分使用了Node API的模块无法在浏览器中运行\n\n首先我们来看一下Node模块在运行的时候真相是怎样的，假设我们有如下模块`example1.1.js`：\n\n```javascript\nvar me = {};\nmodule.exports = me;\n```\n\n这是一个非常简单的Node模块。不知道大家在写Node模块的时候是否有好奇过，这里的`module`（以及`require` / `exports` / `__filename` / `__dirname`）是从哪里来的？因为按照对JS的认知，如果它不是一个局部变量（含函数形参）的话，那么只能是全局变量了。\n\n难道这些变量是全局变量？然而当我们打开Node的命令行去访问的时候又明明白白地告诉我们是`undefined`：\n\n```sh\n> console.log(global.exports)\nundefined\n\n> console.log(global.__dirname)\nundefined\n\n```\n\n> 按照Node的文档，`global.require`确实是存在的，还有`.cache` / `.resolve()`等成员，但每个模块中使用的`require`仍然是局部变量，并非全局`require`。\n\n这到底是怎么回事呢？如果在运行的时候去查看它的话，它会变成这样：\n\n```javascript\n(function (exports, require, module, __filename, __dirname) {\n    var me = {};\n    module.exports = me;\n});\n```\n\n> 可以使用`node-inspector`去远程调试Node代码，于是就能看到模块运行时的真实代码。\n\n可以看到，我们的模块代码在运行的时候是被包裹了一层的，而上面列的这些变量正是在这个包裹函数中作为形参传入的。\n\n其中`module`指向模块本身，`module.exports`和`exports`是等价的，表示模块要导出供调用的内容，`__filename`表示当前模块的文件名，`__dirname`表示当前模块所在路径。\n\n因此，并不是所有的Node模块都能为浏览器所用。尽管如此，webpack也还是为这些包裹函数带来的新变量（形参）提供了模拟，可以在浏览器端使用的代码中注入这些变量。由于使用得少，而且该选项在CLI中并没有提供，需要另配config文件，故此处不再演示。\n\n"
  },
  {
    "path": "zh-cn/chapter2/non-moduler.md",
    "content": "# 非模块化文件打包\n\n为了演示webpack的强大，我们将首先演示非模块化文件打包。\n\n## Demo\n\n首先准备一个HTML（`example1.1.html`）：\n\n```html\n<html>\n\t<head>\n\t\t<title>webpack.toobug.net</title>\n\t\t<script src=\"./bundle1.1.js\"></script>\n\t</head>\n\t<body>\n\t</body>\n</html>\n```\n\n> 前面解释过，webpack是一个开发时进行打包的工具，因此我们需要准备两份文件，一份是用于开发维护的源码，一份则是由webpack打包生成的文件。\n>\n> 在这个示例中，我们关注源码就好。如果是放到实际项目中，则也需要仔细规划打包后文件的路径。\n\n首先我们使用非模块化的方案，准备我们的源文件`example1.1.js`：\n\n```javascript\nalert('hello world');\n```\n\n接下来使用webpack将它打包：\n\n\n```sh\ncd {index.html所在目录}\nwebpack example1.1.js bundle1.1.js\n```\n\n此时就可以看到目录下生成了一个`bundle1.1.js`，正是我们在html中引用的JS文件。\n\n访问一下`example1.1.html`，则可以看到我们的弹出框。\n\n![1.1.1](../images/chapter2/non-moduler/1.1.1.png)\n\n## 解析\n\n看到这里，你可能会开始怀疑人生了：你真的不是在逗我玩吗？这么简单一个demo，我直接引用源文件不就好了？干嘛要用webpack打包，多此一举？\n\n这个问题，我也无法回答你，非模块化的文件被模块化打包工具支持，本来就是一件很神奇的事情。至于初衷，我也只能想到是为了让开发者能更低成本地迁移到webpack上来。\n\n不过，为了保证我真的没有忽悠你，我们还是可以看一看打包之后的文件：<https://github.com/TooBug/webpack-guide/blob/master/examples/chapter2/non-moduler/bundle1.1.js>。可以看到，一个原本1行的JS文件被打包成了一个50行的文件。而这剩下的49行到底是什么呢？我们简单解析一下：\n\n整体上看，文件被分为两个部分：第1至41行，是一个函数定义，这也就是官方文档中提到的**Runtime**，作用是保证模块的顺利加载和运行。第45至49行则是我们原来写的JS文件，只是被包裹了一个函数，也就是**模块**。运行的时候模块是作为Runtime的参数被传进去的，也就是这样的形式：\n\n```javascript\n(function(modules){\n\t// Runtime\n})([\n\t// 模块数组\n])\n```\n\n这里面特别值得注意的一点是第20行和第45行。\n\n```javascript\n// 第20行\nmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n// 第45行\nfunction(module, exports) {\n```\n\n其中第45行是模块被包裹的函数，给了`module`和`exports`参数。（如果有需要的话，还会给出`require`参数。）而这两个参数本质上都是Runtime中定义的`module.exports`，是一个空对象（第14行）。这样就实现了使用Common.js的方式来定义模块返回值。不过由于我们还在讨论非模块化的文件，就不深入。\n\n真正值得注意的是第20行，使用了`.call`，第一个参数是`module.exports`，这就导致模块的包裹函数的作用域中的`this`指向了`module.exports`。这会带来两个后果：\n\n1. 模块中无法使用`this`指代全局变量（浏览器中就是`window`）\n2. 模块中可以使用`this.xxx`来指定模块包含的成员，类似Common.js中`exports.xxx`的方式（感觉我们找到了除AMD/Common.js之外的另一种模块化规范，不过因为webpack官方并没有强调这个，我们也只是代过。）\n\n## 影响\n\n当然，聪明的你肯定早就意识到了另一个更明显的结果，即模块不是暴露在全局作用域下了。也即通过`var xxx`的方式定义的`xxx`变量不再挂在全局对象下。这可能是在非模块化的代码迁移到webpack中碰到的最大的问题，需要手工将`var xxx`的定义方式改为`window.xxx`。\n\n同样，由于模块源码是采用非模块化的方案编写的，因此没有通过AMD的`return`或者CommonJS的`exports`或者`this`导出模块本身，这会导致模块被引入的时候只能执行代码而无法将模块引入后赋值给其它模块使用。\n\n例如上面的`example1.1.js`，当我们引入的时候（以CommonJS为例），`var a = require('example1.1');`，此时`a`为`undefined`。\n\n你可能觉得这样好像没什么意义是吧？但是事实上有大量的模块是用这种方式编写的，包括著名的Angular.js（1.4以下），这会导致无法直接使用`var angular = require('angular')`来引入`angular`，需要通过额外的方式来做（exports-loader），后面详述。\n\n"
  },
  {
    "path": "zh-cn/chapter2/umd.md",
    "content": "# UMD模块打包\n\n按理说，分别讲完非模块化、AMD、CommonJS的打包后，并没有必要再专门引入一篇讲UMD打包的。但因为UMD的实现中依赖一些特殊的变量，因此还是提一下。\n\n首先回顾一下UMD的模块定义：\n\n```javascript\n(function (root, factory) {\n    if (typeof define === 'function' && define.amd) {\n        // AMD. Register as an anonymous module.\n        define(['b'], factory);\n    } else if (typeof module === 'object' && module.exports) {\n        // Node. Does not work with strict CommonJS, but\n        // only CommonJS-like environments that support module.exports,\n        // like Node.\n        module.exports = factory(require('b'));\n    } else {\n        // Browser globals (root is window)\n        root.returnExports = factory(root.b);\n    }\n}(this, function (b) {\n    //use b in some fashion.\n\n    // Just return a value to define the module export.\n    // This example returns an object, but the module\n    // can return a function as the exported value.\n    return {};\n}));\n```\n\n上面的代码来自<https://github.com/umdjs/umd/blob/master/returnExports.js>。我们按这样的方式来定义一个模块`example1.1.js`（去掉了对`b`的依赖），看看webpack会如何处理。\n\n打包后的代码见<https://github.com/TooBug/webpack-guide/blob/master/examples/chapter2/umd/bundle1.1.js>，可以看到，使用UMD声明的模块会默认按照AMD的方式去打包。而核心的一句就是第48行，原本是\n\n```javascript\nif (typeof define === 'function' && define.amd) {\n```\n\n被webpack直接替换成了\n```javascript\nif (true) {\n```\n\n可见webpack还是相当聪明的！既满足了AMD的判断条件，又没有真的在全局注入`define`变量，这样就不会像require.js一样，一旦引入就无法再使用`<script>`引入UMD脚本。\n\n如果你希望webpack不要使用AMD的方式引入，而是使用CommonJS的方式的话，则需要指定让webpack不按AMD的方式去解析，具体方法则是使用`imports-loader`。\n\n关于loader，后面会有详细解释，这里只说怎么用。首先`npm init`然后`npm install imports-loader --save`安装依赖，接下来在打包时加一些参数：\n\n```sh\nwebpack example1.1.js bundle1.2.js --module-bind 'js=imports?define=>false' \n```\n\n意思是针对`.js`文件，使用`imports-loader`，传给loader的参数是`define=>false`，即定义`define`为`false`，这样模块就不会使用AMD的方式打包了。imports-loader的参数具体含义可参见[文档](https://github.com/webpack/imports-loader)。\n\n打包后的代码见<https://github.com/TooBug/webpack-guide/blob/master/examples/chapter2/umd/bundle1.2.js>，如我们所愿，AMD的条件判断不再是`true`。因为没有`define`变量，又因为在模块的包裹函数中传了`module`且`module.exports`存在，所以最终这个模块会按CommonJS的方式被使用。\n\n\n"
  },
  {
    "path": "zh-cn/chapter3/README.md",
    "content": "# 第三章 webpack进阶\n\n在第二章，我们看到了webpack如何为各种不同的模块化方案编写的模块进行打包。如果webpack的开发者并不是一个负责任的开发者的话，那么有可能故事就到此为止了。然而webpack之所以能红遍大江南北，正是因为它给我们带来了太多惊喜。在本章，我们将对这些进阶技巧逐一展开。\n\n首先，我们会大概分析一下webpack的配置文件及其用法，然后会讲解webpack是如何处理开发过程中碰到的各种实际问题的。希望在看完本章之后，你能自豪地说“我掌握webpack了”。"
  },
  {
    "path": "zh-cn/chapter3/advanced-config.md",
    "content": "# 高级配置项\n\n> 状态：草稿\n\n## `output.publicPath`\n\n一般情况下，用上面的配置就能搞定了。但如果你的网站稍大一点，可能需要引入CDN，而且很可能CDN还有一些很古怪的前缀，这个时候可以通过`output.publicPath`来搞定。\n\n例如，在前面的例子中，输出的脚本路径是`dist/example4.1.js`，而在生产环境中访问的时候却有可能是`http://cdn.toobug.net/scripts/webpack_guide/dist/example4.1.js`。这种情况下，就需要使用`output.publicPath`来将前面的路径补全：\n\n```javascript\noutput:{\n\tpublicPath:'http://cdn.toobug.net/scripts/webpack_guide/'\n}\n```\n\n这样发布到生产环境以后，就会到CDN上对应的路径去加载脚本了。\n\n> 这个选项适用于各种非入口文件的场景，包括分片后的文件、loader加载文件时的路径、css中引入的图片资源文件路径等等。\n\n## `output.library`、`output.libraryTarget`和`output.umdNamedDefine`\n\n如我们在前面很多例子中看到的那样，webpack在打包的时候会将`entry`中配置的文件打包成一个在浏览器中直接运行的文件，也即我们前面定义过的“入口文件”。而如果我们想要的并不是入口文件，而是一个可供其它脚本再引用的类库要怎么办呢？此时就可以用`output.library`和`output.libraryTarget`来告诉webpack，我们想要的打包结果是一个类库。\n\n> todo:介绍一下入口文件和类库一般有什么区别\n\n首先看`output.library`，它被用来指定模块的名字，就像jQuery，它的模块名叫`jquery`，至于这个名字有什么用，马上就会看到。我们在后文中都以{Library}来代替它的值。\n\n`output.libraryTarget`，它的意思是指定打包后的脚本如何导出模块。前面我们介绍过模块化规范，有AMD、CommonJS、UMD以及直接定义变量等等。这个选项即是指定用哪种方式来对模块内容进行导出。\n\n它的可选项如下：\n\n- 'var' 通过`var {Library} = xxx;`的方式导出模块，即定义（隐性）全局变量\n- 'this' 通过`this[{Library}] = xxx;`的方式导出模块，其中this一般指向window，也是定义全局变量\n- 'commonjs' 通过指定`exports`属性的方式导出模块，例如`exports[{Library}] = xxx;`，引用的时候需要`require('xxx.js')[{Library}]`才能引用到`xxx`。\n- 'commonjs2' 通过指定`module.exports`的方式导出模块，例如`module.exports = xxx;`，引用的时候直接使用`require('xxx.js')`即可引用到`xxx`。\n\n\n\n\n"
  },
  {
    "path": "zh-cn/chapter3/chunks.md",
    "content": "# 分片\n\n> 状态：草稿\n\n随着项目开发过程中越来越大，我们的代码体积也会越来越大，而将所有的脚本都打包到同一个JS文件中显然会带来性能方面的问题（无法并发，首次加载时间过长等）。\n\nwebpack也提供了代码分片机制，使我们能够将代码拆分后进行异步加载。\n\n> 值得注意的是，webpack对代码拆分的定位仅仅是为了解决文件过大，无法并发加载，加载时间过长等问题，并不包括公共代码提取和复用的功能。对公共代码的提取将由CommonChunks插件来完成。\n\n要使用webpack的分片功能，首先需要定义“分割点”，即代码从哪里分割成两个文件。\n\n## 分割点\n\n分割点表示代码在此处被分割成两个独立的文件。具体的方式有两种。\n\n使用`require.ensure`：\n\n```javascript\nrequire.ensure([\"module-a\", \"module-b\"], function(require) {\n\tvar a = require(\"module-a\");\n\t// ...\n});\n```\n\n使用AMD的动态`require`：\n\n```javascript\nrequire([\"module-a\", \"module-b\"], function(a, b) {\n\t// ...\n});\n```\n\n上面的例子中，`module-a`和`module-b`就会被分割到独立的文件中去，而不会和入口文件打包在同一个文件中。\n\n> TODO：module-a和module-b何时会在同一个文件，何时不会在同一个文件？\n\n![chunks](../images/chapter3/chunks/1.1.png)\n\nexample1中使用了`require.ensure`和AMD动态`require`两种方式，来建立分割点，代码在此处被分片。\n\n\n```javascript\nvar a=require('./a');\na.sayHello();\n\nrequire.ensure(['./b'], function(require){\n    var b = require('./b');\n    b.sayHello(); \n});\n\nrequire(['./c'], function(c){\n    c.sayHello();\n});\n\n```\n\n打包后的代码：\n\n- bundle.js -> main.js + a.js\n- 1.bundle.js -> b.js\n- 2.bundle.js -> c.js\n\n## 多入口\n\n多入口的情况下：\n\n- 入口1 bundle.main1.js -> main.js + a.js\n- 入口2 bundle.main2.js -> main2.js + a.js\n- 1.bundle.1.js -> b.js\n- 2.bundle.2.js -> c.js\n\n可见公共代码a.js并没有被提取出来。\n\n> 因此分片只是分片，并没有自动提取公共模块的作用。"
  },
  {
    "path": "zh-cn/chapter3/cli-api.md",
    "content": "# CLI与API使用模式\n\n在进入配置项讲解之前，我们首先看一看webpack为我们提供的使用方式：CLI和API。\n\n## CLI\n\nCLI即Command Line Interface，顾名思义，也就是命令行用户界面。到目前为止，我们所有的示例都是以这种方式调用的，例如：\n\n```sh\nwebpack example1.1.js bundle1.1.js\n```\n\n如果我们直接执行`webpack`，不加任何参数（且当前目录不存在配置文件），则会显示webpack的帮助信息，里面有非常多的参数可用。事实上，除了我们前面这种出于演示的目的直接在命令行中写参数之外，大部分生产环境下使用时都会需要加上非常多的参数，导致整个命令非常长，既不利于记忆编写，也不利于传播交接等。因此，一般会将配置项写在同目录的`webpack.config.js`中，然后执行`webpack`即可，webpack会从该配置文件中读取参数，此时不需要在命令行中传入任何参数。\n\n```sh\n# 执行时webpack会去寻找当前目录下的webpack.config.js当作配置文件使用\nwebpack\n\n# 也可以用参数-c指定配置文件\nwebpack -c mycofnig.js\n```\n\n配置文件`webpack.config.js`的写法则是：\n\n```javascript\nmodule.exports = {\n\t// 配置项\n};\n```\n\n值得注意的是，配置文件是一个真正的JS文件，因此配置项只要是一个对象即可，并不要求是JSON。也就意味着你可以使用表达式，也可以进行动态计算，或者甚至使用继承的方式生成配置项。\n\n## API\n\nAPI则是指将webpack作为Node.js模块使用，例如：\n\n```javascript\nwebpack({\n\t// 配置项\n\tentry:'main.js',\n\t...\n},callback);\n```\n\n到目前为止，我们所有的示例都还没有用到这种用法。但这种用法并不少见，尤其是在和构建工具（如Gulp）搭配使用的时候，都是使用的这种方式。你也可以自己写一段程序来调用webpack。相比CLI模式而言，使用API模式会更加灵活，因为可以与你的各种工具进行集成，甚至共享一些环境变量然后动态生成打包配置等等，在复杂项目中会很有用。\n\n同理，API模式中的配置项对象也是一个真正的对象。"
  },
  {
    "path": "zh-cn/chapter3/common-chunks-plugin.md",
    "content": "# CommonChunks插件\n\n## 问题\n\n顾名思义，Common Chunks 插件的作用就是提取代码中的公共模块，然后将公共模块打包到一个独立的文件中去，以便在其它的入口和模块中使用。\n\n`main.js`：\n\n```javascript\nvar a=require('./a');\na.sayHello();\n\n\nvar b = require('./b');\nb.sayHello(); \n\nvar c = require('./c');\nc.sayHello();\n```\n\n`main.2.js`：\n\n```javascript\nvar a=require('./a');\na.sayHello();\n\n\nvar b = require('./b');\nb.sayHello(); \n```\n\n`a`、`b`、`c`和之前一样，只有一个`sayHello()`方法。\n\n打包后看到`bundle.main1.js`和`bundle.main2.js`中分别包含了`a`、`b`、`c`三个模块。其中的`a`和`b`正是我们要使用CommonChunksLoader提取出来的公共模块。\n\n## 小试牛刀\n\n接下来，我们在配置项中添加CommonChunksLoader的配置，使用它来提取公共模块。\n\n```javascript\nvar webpack = require('webpack');\n\nmodule.exports = {\n    entry:{\n        main1:'./main',\n        main2:'./main.2'\n    },\n    output:{\n        filename:'bundle.[name].js'\n    },\n    plugins: [\n        new  webpack.optimize.CommonsChunkPlugin('common.js', ['main1', 'main2'])\n    ]\n};\n```\n\n注意第1行，添加了webpack的引用（同时也要在项目目录下安装webpack），然后添加了`plugins`选项，引用了`webpack.optimize.CommonsChunkPlugin`来提取公共模块，参数`common.js`表示公共模块的文件名，后面的数组元素与`entry`一一对应，表示要提取这些模块中的公共模块。\n\n重新使用`webpack`打包后，看到生成的文件中多了一个`common.js`：\n\n```sh\nwebpack                                                                                                                                                                                                                              \nHash: 2eaa6808a94e7ed42693\nVersion: webpack 1.12.8\nTime: 99ms                                                                                                                                            Asset       Size  Chunks             Chunk Names\nbundle.main1.js  417 bytes       0  [emitted]  main1\nbundle.main2.js  193 bytes       1  [emitted]  main2\n      common.js     3.9 kB       2  [emitted]  common.js\n   [0] ./main.js 117 bytes {0} [built]\n   [0] ./main.2.js 77 bytes {1} [built]\n   [1] ./a.js 97 bytes {2} [built]\n   [2] ./b.js 97 bytes {2} [built]\n   [3] ./c.js 97 bytes {0} [built]\n```\n\n这个`common.js`正是公共部分`a`和`b`两个模块。而生成的`bundle.main1.js`中只包含了`c`模块，`bundle.main2.js`中则没有包含任何其它模块。生成后的代码可参见<https://github.com/TooBug/webpack-guide/blob/master/examples/chapter3/common-chunks-plugin>。\n\n当然，还有一步不能少，就是在HTML中加入公共部分`common.js`：\n\n```html\n<script src=\"./common.js\"></script>\n<script src=\"./bundle.main1.js\"></script>\n```\n\n运行时截图如下：\n\n![../images/chapter3/common-chunks-plugin/1.png](../images/chapter3/common-chunks-plugin/1.png)\n\n## 另一个问题\n\n上面的代码成功地将公共模块`a`和`b`提取出来了。但不知道看到此处，你的心里是否会有点疑问。\n\n如果你还没有的话，我们一起来看一下下面这些东东：\n\n1. 什么是入口文件？如果你还记得前面我们给出的定义的话，就会发现，这个地方有两个入口文件！\n2. 模块化方案应该允许多个入口文件吗？应该吗？不应该吗？应该吗？不应该吗？\n3. 如果模块规划调整了，`common.js`消失了，或者增加了一个`common.2.js`，我应该修改每一个HTML引入的部分吗？\n\n其实写到这里，我是有点迷茫的，按照我对模块化方案的认知，我的观点是：\n\n1. 入口文件应该只有一个，其它的逻辑全部由入口文件处理，因此不应该允许多入口文件\n2. 模块规划应该在模块化方案内部完成，不应该还需要时时调整模块调用入口\n\n"
  },
  {
    "path": "zh-cn/chapter3/config.md",
    "content": "# 基本配置项\n\n## `entry`和`output`\n\n首先我们写一个简单的配置文件，将前面我们用到的命令行参数放到配置文件中来。\n\n`webpack.config.js`：\n\n```javascript\nmodule.exports = {\n    entry:'./example1.1',\n    output:{\n        filename:'bundle1.1.js'\n    }\n};\n```\n\n示例文件仍然使用CommonJS打包示例中的JS文件：\n\n```javascript\nmodule.exports = {\n    sayHello:function(){\n        alert('Hello World!');\n    }\n};\n```\n\n然后直接使用`webpack`打包即可：\n\n```sh\nwebpack\n```\n\n输出\n\n```\nHash: 0cf5b5109a8f4bf34ae5\nVersion: webpack 1.12.2\nTime: 70ms\n       Asset     Size  Chunks             Chunk Names\nbundle1.1.js  1.48 kB       0  [emitted]  main\n   [0] ./example1.1.js 83 bytes {0} [built]\n```\n\n同时生成了`bundle1.1.js`，可见配置文件的确是生效了的。代码见<https://github.com/TooBug/webpack-guide/blob/master/examples/chapter3/config/example1>。\n\n### `output.filename`中的占位符\n\n`output.filename`除了可以指定具体的文件名以外，还可以使用一些占位符，包括：\n\n- `name` 模块名称\n- `hash` 模块编译后的（整体）Hash值\n- `chunkhash` 分片的Hash值\n\n使用的方式就是在`output.filename`的中使用`[name].js`或者`my-[name]-[hash].js`之类的，一看就明白。但这三个值具体是从哪里来的呢？\n\n首先，我们一次有可能要打包很多模块，而不止是上例中那样只有一个`example1.1.js`，因此会碰到支持多个入口文件（`entry`）的情况，每一个入口都需要有自己的名字，具体对应`entry`的写法而言，有如下几种情况：\n\n```javascript\nentry:'./example2.1'\n// 或者\nentry:['./example2.1','./example2.2']\n```\n\n这种情况下，模块是没有名字的，webpack会使用`main`作为模块名字，因此像下面这种用数组来指定入口的情况，模块名会重复，而此时webpack会将它们的代码合并打包！\n\n```sh\nHash: 1af82371840be6a233d2\nVersion: webpack 1.12.2\nTime: 101ms\n  Asset     Size  Chunks             Chunk Names\nmain.js  1.76 kB       0  [emitted]  main\n   [0] multi main 40 bytes {0} [built]\n   [1] ./example2.1.js 83 bytes {0} [built]\n   [2] ./example2.2.js 84 bytes {0} [built]\n```\n\n注意上方的`multi main`字样，表示有多个模块名为`main`。这种情况下的代码见<https://github.com/TooBug/webpack-guide/blob/master/examples/chapter3/config/example2>，里面包含了使用`[name]`和`[hash]`打包出来的代码，均包含了`example2.1`和`example2.2`的代码。\n\n另一种是webpack比较推荐的多入口写法：\n\n```javascript\nentry:{\n\t'example2.1':'example2.1.js',\n\t'example2.2':'example2.2.js'\n}\n```\n\n这种写法中，名字和模块文件名一一对应，每个模块都有独立的名字。因此这里的`[name]`可以理解成模块名字。\n\n事实上，在webpack的文档中，这个name是指“chunk name”，即分片的名字，这里需要先剧透一下后面要说的“分片”的概念。所谓分片就是指一个入口模块的代码有可能会被分成多个文件，还有一些文件可能是来自模块的公共代码，而不是入口模块。因此这里的`[name]`并非严格与入口模块一一对应。\n\n了解了这些情况之后，`[hash]`和`[chunkhash]`就自然好理解了，一个是指本次打包相关的整体的hash，一个是指分片的hash。\n\n看示例：\n\n```javascript\nmodule.exports = {\n    entry:{\n    \t'example3.1':'./example3.1',\n    \t'example3.2':'./example3.2'\n    },\n    output:{\n    \t//这里分别用hash和chunkhash，结果不一样\n        filename:'[name]-[hash].js'\n        //filename:'[name]-[chunkhash].js'\n    }\n};\n```\n\n为了让两个模块不一样，我们将`example3.1`和`example3.2`中`alert`的内容做了修改，保证它们的内容是不一样的。用`[hash]`时打包的结果：\n\n```sh\nHash: 6f17d6321f8580500bc9\nVersion: webpack 1.12.2\nTime: 73ms\n                             Asset     Size  Chunks             Chunk Names\nexample3.1-6f17d6321f8580500bc9.js  1.48 kB       0  [emitted]  example3.1\nexample3.2-6f17d6321f8580500bc9.js  1.48 kB       1  [emitted]  example3.2\n   [0] ./example3.1.js 88 bytes {0} [built]\n   [0] ./example3.2.js 88 bytes {1} [built]\n```\n\n可以看到两个文件hash值是一样的，这就是所谓整体hash的意思（官方文档叫作`bundle`的hash值）。\n\n用`[chunkhash]`时打包的结果：\n\n```sh\nHash: 87ac4d29062084750a92\nVersion: webpack 1.12.2\nTime: 75ms\n                             Asset     Size  Chunks             Chunk Names\nexample3.1-ef6b40ba3b9335fc2551.js  1.48 kB       0  [emitted]  example3.1\nexample3.2-b92fc07f9784897342c5.js  1.48 kB       1  [emitted]  example3.2\n   [0] ./example3.1.js 88 bytes {0} [built]\n   [0] ./example3.2.js 88 bytes {1} [built]\n```\n\n两个文件hash值是不同的，也就是每一个分片的hash都不一样。\n\n代码见<https://github.com/TooBug/webpack-guide/blob/master/examples/chapter3/config/example3>。\n\n## `output.path`\n\n有时候我们希望输出的文件不在当前目录（其实大部分时候都是这样），比如源码在`src`目录，输出的文件在`dist`目录，此时就需要用到`output.path`来指定输出路径。\n\n> `output.path`也可以使用占位符。\n\n```javascript\nentry:{\n    'example4.1':'src/example4.1'\n},\noutput:{\n    filename:'[name].js',\n    path:'./dist'\n}\n```\n\n你肯定能猜到，文件会打包到`dist/example4.1.js`，这并没有什么好惊奇的，对，我是说没什么好演示的。\n\n真正值得注意的是，如果你的模块是存放在子目录中的，而你又想保持这种目录结构到打包后的`dist`中，怎么办？没听懂是吧，就是这种情况：\n\n```\nsrc/\n    example4.1.js\n    hello/\n        example4.2.js\n```\n\n希望打包之后是这样：\n\n```\ndist/\n    example4.1.js\n    hello/\n        example4.2.js\n```\n\n这种情况下，子目录并不能由`output.path`配置而来，而应该将目录写到模块名上，配置文件变成这样：\n\n```javascript\nentry:{\n    'example4.1':'./src/example4.1',\n    'hello/example4.2':'./src/hello/example4.2'\n},\noutput:{\n    filename:'[name].js',\n    path:'./dist'\n}\n\n```\n\n注意这里的`filename`一定要包含`[name]`才行，因为路径信息是带在模块名上的。\n\n代码见<https://github.com/TooBug/webpack-guide/blob/master/examples/chapter3/config/example4>。\n\n\n"
  },
  {
    "path": "zh-cn/chapter4/bundle-loader.md",
    "content": "# bundle-loader\n\nbundle-loader是一个用来在运行时异步加载模块的loader。\n\n```javascript\n// 在require bundle时，浏览器会加载它\nvar waitForChunk = require(\"bundle!./file.js\");\n\n// 等待加载，在回调中使用\nwaitForChunk(function(file) {\n    // 这里可以使用file，就像是用下面的代码require进来一样\n    // var file = require(\"./file.js\");\n});\n\n// todo：这句注释说的是？\n// wraps the require in a require.ensure block\n```\n\n上面的例子中，在`require`时文件就会加载，如果你想在使用的时候再加载的话，可以这样：\n\n```javascript\nvar load = require(\"bundle?lazy!./file.js\");\n\n// 只有在调用load的时候才会真正加载\nload(function(file) {\n\n});\n```\n\n但前面我们已经在“分片”相关的内容中知道，将代码分片之后，本身就是异步加载的。为什么要使用bundle-loader呢？\n\n这是因为webpack在进行分片的时候，会根据“分割点”，分片配置项等各种情况选择性地将各个模块打包在一起。例如：\n\n```javascript\nrequire([\"./f1\", \"./f2\"], function(f1, f2) {/*...*/});\n```\n\n在打包的时候，`f1`和`f2`会被打包到同一个文件中去（也可能还有其它的文件一起），这样加载的时候`f1`和`f2`是一起加载的。\n\n而如果使用bundle-loader的话，则是独立的文件和独立的请求：\n\n```javascript\nvar f1 = require(\"bundle!./f1\");\nvar f2 = require(\"bundle!./f2\");\n```\n\n`f1`和`f2`是独立打包和请求的。\n\n这有什么意义呢？是的，如果`f1`和`f2`都是确定的，当然是打包到一起更好，能很好地减少浏览器发起的请求，加快页面加载速度。但如果模块名是动态的呢？\n\n```javascript\nfunction loadPage(pageName, callback) {\n  try {\n    require([\"./pages/\" + pageName], function(page) {\n      callback(null, page);\n    });\n  } catch(e) {\n    calback(e);\n  }\n}\n```\n\n这种情况下webpack为了保证不管`pageName`传什么都能正确加载，会将`./pages/`目录下的所有文件打包到一个文件中去，而很多时候，我们更希望每传一个`pageName`就动态加载一个文件，而不是全部加载。此时就可以用bundle-loader解决：\n\n```javascript\nfunction loadPage(pageName, callback) {\n  try {\n    var pageBundle = require(\"bundle!./pages/\" + pageName)\n  } catch(e) {\n    return callback(e);\n  }\n  pageBundle(function(page) { callback(null, page); })\n}\n```\n\n每个模块会被打包到一个独立的文件中去，加载时也只会加载一个模块的内容。\n\n"
  },
  {
    "path": "zh-cn/chapter4/exports-loader.md",
    "content": "# exports-loader\n\nexports，导出的意思，顾名思义，这个loader是用来将（模块中的）某些内容导出的。之所以为“模块中的”加上括号，是因为实际上只要在模块中能被访问到的成员（变量）都可以被导出，当然也包括全局变量。\n\n> export导出在这里有特定含义，指将模块中的内容暴露出来，供使用方使用。例如CommonJS中的`exports.xxx=xxx`或者`module.exports=xxx`，以及AMD中的`return xxx`都叫导出，导出后外部模块引用时就可以使用被导出的部分。没导出的部分将作为模块私有部分，外部无法访问。\n\n## 导出全局变量\n\n在实际使用中，用`exports-loader`最多的场景是将某些不支持模块化规范的模块所声明的全局变量作为模块内容导出。以Angular.js为例（1.3.14以下版本），它不支持模块化引用，因此如果直接使用以下代码引用`angular`是无效的：\n\n```javascript\nvar angular = require('angular');\n```\n\n此时，`angular`仍然是一个挂载在`window`上的全局变量，而`require`返回的却是`undefined`，导致上述`angular`变量为空。此时就需要我们使用`exports-loader`将全局的`window.angular`作为`angular`模块的返回值暴露出来。\n\n看一个例子，在这个例子中，我们没有真的引用`angular.js`，而是在`example1.2.js`中声明了一个全局变量`HELLO`：\n\n```javascript\nwindow.Hello = function(){\n\tconsole.log('hello from global Hello() function');\n};\n```\n\n接下来，在`example1.1.js`中引用这个模块：\n\n```javascript\nvar Hello = require('./example1.2');\n\nHello();\n```\n\n然后直接使用webpack打包，生成`bundle1.js`，运行截图如下：\n\n![exports-loader](../images/chapter4/exports-loader/1.png)\n\n可以看到，由于`example1.2`并没有导出模块，导致`example1.1`在引用的时候报错，找不到`Hello`这个函数。\n\n此时就轮到`exports-loader`上场了。我们建立一个`webpack.config.js`：\n\n```javascript\nmodule.exports = {\n\tmodule:{\n\t\tloaders:[\n\t\t\t{ test: require.resolve('./example1.2'), loader: \"exports?Hello\" }\n\t\t]\n\t}\n};\n```\n\n其中的`test`表示使用`loader`的条件，这里使用了`require.resolve`解析出来的路径，表示只处理`example1.2.js`，loader中指定了`exports-loader`，参数为`Hello`，意为将`Hello`作为模块导出值。\n\n重新打包生成`bundle2.js`，运行截图如下：\n\n![exports-loader](../images/chapter4/exports-loader/2.png)\n\n可见`Hello`函数已被正确调用。\n\n查看`bundle2.js`中的代码可以清楚地看到`HELLO`被导出的过程：\n\n```javascript\n/***/ function(module, exports) {\n\n\twindow.Hello = function(){\n\t\tconsole.log('hello from global Hello() function');\n\t};\n\n\n\t/*** EXPORTS FROM exports-loader ***/\n\tmodule.exports = Hello;\n\n/***/ }\n```\n\n> 注：这里其实有两个示例，分别生成了`bundle1.js`和`bundle2.js`，由于`bundle1.js`需要在`webpack.config.js`生效前创建，因此如果你克隆代码后自己运行的话，在生成`bundle1.js`前请将`webpack.config.js`改名，否则其中的配置会生效，最终效果和第二例一样。\n\n## 导出局部变量\n\n如前文所述，`exports-loader`可以导出一切在模块内可以访问的变量，因此如果模块内定义了一个局部变量，也是可以导出的，方法和上面的例子几乎完全一样，这里就不再演示。\n\n## 更多用法\n\n上面例子中的配置文件是通过`webpack.config.js`来指定的，你也可以选择用其它方法来指定，详情见[使用loader](./using-loaders.html)。\n\n此外，上面例子中我们只导出了一个变量，此时该变量就是模块被引用时的值（通过`module.exports`导出）。事实上，`exports-loader`还可以支持同时导出多个变量，例如`exports?HELLO,WORLD`会生成如下代码：\n\n```javascript\nexports.HELLO = HELLO;\nexports.WORLD = WORLD;\n```\n\n此时模块的导出值是一个对象，其中的各个键值对是我们指定的变量，引用时需要使用类似`require('example1.2').HELLO`的形式。\n\n`exports-loader`还支持变量名和导出名不同，例如`exports?HELLO=obj.hello,WORLD=shijie`会生成如下代码：\n\n```javascript\nexports.HELLO = obj.hello;\nexports.WORLD = shijie;\n```\n\n一目了然，不再解释。\n\n本文全部示例代码见<https://github.com/TooBug/webpack-guide/tree/master/examples/chapter4/exports-loader/example1>。\n"
  },
  {
    "path": "zh-cn/chapter4/expose-loader.md",
    "content": "# expose-loader\n\n> 状态：草稿\n\nexpose是暴露的意思，那么expose-loader的作用即是将变量暴露到window对象下成为全局变量。\n\n## 使用\n\n```javascript\nrequire('expose?GLOBAL_VAR!example.js');\n```\n\n在使用expose-loader之后，模块原本要导出的内容（`module.exports`）会被暴露到全局变量中，而全局变量的名字则是上面示例中的`GLOBAL_VAR`。这个全局变量的名字是可以自己定义的。\n\n例如官方有一个示例，将`React`暴露到全局变量：\n\n```javascript\nrequire('expose?React!react');\n```\n\n要将模块导出的内容暴露给多个全局变量的话，可以使用多次expose-loader：\n\n```javascript\nexpose?$!expose?jQuery!\n```\n\ntodo: 与exports-loader结合使用\n"
  },
  {
    "path": "zh-cn/chapter4/imports-loader.md",
    "content": "# imports-loader\n\n> 状态：草稿\n\nimports，顾名思义是导入的意思，这个loader的作用与exports-loader刚好相反，是用来将其它模块导入到当前模块中。这个loader常常在处理一些非模块化规范编写的文件时被用到。\n\n## 背景\n\n举个简单的例子，有模块`b`，依赖全局变量`window.a`，那么在没有使用模块化规范的情况下，有可能它的代码中会直接写`a`：\n\n```javascript\n// 模块b直接依赖全局变量a\na.xxx();\n```\n\n而如果`a`经过webpack打包，则很有可能不会暴露全局变量，此时就需要使用imports-loader来对`a`进行导入。\n\n## 使用\n\n> todo:例子\n\n```javascript\nrequire('imports?$=jquery!./example.js');\n\nrequire('imports?$=jquery,angular,config=>{size:50}!./file.js');\n```\n\n## 典型使用场景\n\n- 为jQuery插件注入$变量 `imports?$=jquery`\n- 自定义angular `imports?angular`\n- 让umd模块检测不到define方法从而避免使用amd规范 `imports?define=>false`\n- 将模块中的`this`还原为`window` `imports?this=window`\n\n一目了然，不再解释。\n\n本文全部示例代码见<https://github.com/TooBug/webpack-guide/tree/master/examples/chapter4/exports-loader/example1>。\n"
  },
  {
    "path": "zh-cn/chapter4/using-loaders.md",
    "content": "# 使用loader\n\n在webpack中，可以使用`require('./a')`的方式来引入`a.js`，如果你是从前文一路看过来的话会发现这并没有什么新奇的。那loader是做什么的呢？\n\nloader是webpack中一个重要的概念，它是指用来将一段代码转换成另一段代码的webpack插件。晕了没？为什么需要将一段代码转换成另一段代码呢？这是因为webpack实际上只能处理JS文件，如果需要使用一些非JS文件（比如Coffee Script），就需要将它转换成JS再`require`进来。当然，这个代码转换的过程能做的远不止是Coffee->JS这么简单，稍后将看到它的无穷魅力。\n\n> 虽然本质上说，loader也是插件，但因为webpack的体系中还有一个专门的名词就叫插件（plugins），为避免混淆，后面不再将loader与插件混淆说，后文中这将是两个相互独立的概念。\n\n## 用途\n\nwebpack处理的主要对象是JS文件，而我们知道JS文件是可以做很多事情的，比如编译Less/SASS/CoffeeScript，比如在页面中插入一段HTML，比如修改替换文本文件等等。既然如此，我们能不能将这些能力集中到webpack上来呢，比如我在`require('a.coffee')`的时候，webpack自动帮我把它编译成JS文件，再当成JS文件引入进来？或者更极端一点，`require('a.css')`的时候，直接将CSS变成一段JS，用这段JS将样式插入DOM中呢？\n\n这些，正是loader要做的事情。\n\n## 用法\n\n为了言之有物，以下皆以`coffee-loader`为例来说明。\n\n> coffee就是指coffee script啦，可以算是JS的一种方言，深受ruby/python党喜爱。虽然笔者并不使用coffee，也不提倡使用，但这个loader相对比较典型，容易理解。在生产环境中，更提倡使用ES6编写代码，然后使用babel-loader编译成ES5代码使用，但因为babel 6改成了插件式的，配置项略多，为了简单起见，先不使用这个。\n\n`coffee-loader`的作用就是在引用`.coffee`文件时，自动转换成JS文件，这样可以省去额外的将`.coffee`变成`.js`的过程。\n\n首先我们准备一个`example1.1.js`：\n\n```javascript\nvar hello = require('coffee!./example1.2.coffee');\nhello.sayHello();\n```\n\n值得注意的是这里在`require`参数最前面加了`coffee!`，这个表示使用`coffee-loader`来处理文件内容。详细的机制稍后说明。\n\n接下来，准备`example1.2.coffee`：\n\n```coffeescript\nclass Hello\n\tconstructor: (@name) ->\n\n\tsayHello: () ->\n\t\talert \"hello #{@name}\"\n\nmodule.exports = new Hello 'world'\n```\n\n接下来，我们需要安装`coffee-loader`。webpack的每一个loader命名都是`xxx-loader`，在安装的时候需要将对应的loader装到项目目录下：\n\n```sh\nnpm install coffee-loader --save\n```\n\n然后编译：\n\n```sh\nwebpack example1.1.js bundle.js\n```\n\n打HTML，即可看到我们写的代码生效了。\n\n![coffee-loader](../images/chapter4/using-loaders/1.png)\n\n`example1.2.coffee`编译后的代码也可以拿出来看一下：\n\n```javascript\nfunction(module, exports) {\n\n\tvar Hello;\n\n\tHello = (function() {\n\t  function Hello(name) {\n\t    this.name = name;\n\t  }\n\n\t  Hello.prototype.sayHello = function() {\n\t    return alert(\"hello \" + this.name);\n\t  };\n\n\t  return Hello;\n\n\t})();\n\n\tmodule.exports = new Hello('world');\n\n\n/***/ }\n```\n\n完整的代码见<https://github.com/TooBug/webpack-guide/tree/master/examples/chapter4/using-loaders/example1>\n\n## 进阶\n\n知道了loader的作用之后，可以再来多看一看loader的用法了。\n\n首先，除了npm安装模块的时候以外，在任何场景下，loader名字都是可以简写的，`coffee-loader`和`coffee`是等价的，这意味着`require('coffee!./a.coffee')`和`require('coffee-loader!./a.coffee')`是等价的。这一点同样适用于下面讲到的其它用法，不再单独说明。\n\n### 串联\n\nloader是可以串联使用的，也就是说，一个文件可以先经过A-loader再经过B-loader最后再经过C-loader处理。而在经过所有的loader处理之前，webpack会先取到文件内容交给第一个loader。以我们后面经常会涉及的一个例子说明：\n\n```javascript\nrequire('style!css!./style.css');\n```\n\n这个例子的意思是将`style.css`文件内容先经过`css-loader`处理（路径处理、`import`处理等），然后经过`style-loader`处理（包装成JS文件，运行的时候直接将样式插入DOM中。）\n\n### 参数\n\nloader还可以接受参数，不同的参数可以让loader有不同的行为（前提是loader确实支持不同的行为），具体每个loader支持什么样的参数可以参考loader的文档。同样以`coffee-loader`为例，它可以指定一个名为`literate`的参数，意思是……我也不知道，猜测可能是编译非完整的coffee script文件（例如内嵌在markdown中的代码片段等），如果你知道是什么意思，请告诉我。\n\n在上面的用法中，参数的指定方式和url很像，要通过`?`来指定，例如指定`literate`参数需要这样写：\n\n```javascript\nrequire('coffee?literate=1!./a.coffee');\n```\n\n这段代码中指定了`literate`参数为`1`，如果不写`=1`的话，默认值为`true`。（`coffee-loader`官方并没有说可以为1，而是只写了`literate`，没有值）。\n\n### loader使用方法\n\nloader的使用有三种方法，分别是：\n\n- 在`require`中显式指定，即上面看到的用法\n- 在配置项（`webpack.config.js`）中指定\n- 在命令行中指定\n\n第一种我们已经看过了，不再说明。\n\n第二种，在配置项中指定是最灵活的方式，它的指定方式是这样：\n\n```javascript\nmodule: {\n\t// loaders是一个数组，每个元素都用来指定loader\n\tloaders: [{\n\t\ttest: /\\.jade$/,\t//test值为正则表达式，当文件路径匹配时启用\n\t\tloader: 'jade',\t//指定使用什么loader，可以用字符串，也可以用数组\n\t\texclude: /regexp/, //可以使用exclude来排除一部分文件\n\n\t\t//可以使用query来指定参数，也可以在loader中用和require一样的用法指定参数，如`jade?p1=1`\n\t\tquery: {\n\t\t\tp1:'1'\n\t\t}\n\t},\n\t{\n\t\ttest: /\\.css$/,\n\t\tloader: 'style!css'\t//loader可以和require用法一样串联\n\t},\n\t{\n\t\ttest: /\\.css$/,\n\t\tloaders: ['style', 'css']\t//也可以用数组指定loader\n\t}]\n}\n```\n\n在命令行中指定参数的用法用得较少，可以这样写：\n\n```sh\nwebpack --module-bind jade --module-bind 'css=style!css'\n```\n\n使用`--module-bind`指定loader，如果后缀和loader一样，直接写就好了，比如`jade`表示`.jade`文件用`jade-loader`处理，如果不一样，则需要显示指定，如`css=style!css`表示分别使用`css-loader`和`style-loader`处理`.css`文件。\n\n## 更多\n\nloader本质上做的是一个anything to JS的转换，因此想象空间极大，从目前[官方列出的loader列表](https://webpack.github.io/docs/list-of-loaders.html)来看，大致有这样一些用途：\n\n1. 其它语言编译到JS，包括JSON、纯文本、coffee、CSS等，也包括比较复杂的整体方案处理，比如`vue-loader`、`polymer-loader`等\n2. “微处理”类，比如为非模块化文件添加一些模块化导入导出代码，对模块细节（代码）微调等，例如`exports-loader`、`expose-loader`等\n3. 校验和压缩类，这一类其实最终并不生成代码，检验类如果报错就阻止构建进行，压缩类只是替换一下图片资源等\n4. 纯打包类，比如`file-loader`，将资源文件一并纳入路径管理\n\n具体的可以对照官方的loader列表一一查看。\n\n\n\n"
  },
  {
    "path": "zh-cn/chapter6/ts-and-vue.md",
    "content": "# TypeScript与Vue\n\n> 本文适用于webpack 2+\n\n## TypeScript（ts-loader）\n\n要使用TypeScript的话，只需要将文件名后缀改成`.ts`，并引入`ts-loader`进行处理即可。\n\n例如我们有一个TS文件：\n\n```typescript\nfunction a(num: number){\n    return num+1;\n}\n\nconsole.log(a(5));\n```\n\n只需要在`webpack.config.js`中配置一下（注意这是webpack 2+的配置）：\n\n```javascript\nmodule:{\n    rules:[{\n        test: /\\.ts$/,\n        loader:'ts-loader',\n    }]\n}\n```\n\n即可。\n\n## Vue单文件组件（vue-loader）\n\nVue为我们提供了单文件组件的写法，例如下面的`test.vue`：\n\n```vue\n<style>\n    div{\n        color:red;\n    }\n</style>\n<template>\n    <div>{{message}}</div>\n</template>\n<script>\nimport Vue from 'vue/dist/vue.esm.js';\nnew Vue({\n    data: function(){\n        return {\n            message: 'hello'\n        }\n    }\n});\n</script>\n```\n\n这种写法需要使用`vue-loader`转换成纯JS文件才可以正常在浏览器中运行。和使用`ts-loader`类似，只要使用`vue-loader`处理即可，这里就不再演示。唯一值得注意的是`vue-loader`会需要同时安装几个模块，如果弄不清楚的话，安装`vue-loader`的时候留意一下npm的输出，把需要的模块都装上就可以了。\n\n## TypeScript + Vue\n\n基本用法就是同时加上`ts-loader`和`vue-loader`。但是`ts-loader`需要加上两个选项：\n\n```javascript\noptions: {\n    transpileOnly: true,\n    appendTsSuffixTo: [/\\.vue$/],\n}\n```\n\n`transpileOnly`的含义是指让`ts-loader`只做转译。什么意思呢？就是不加这个选项的话，它会把转义的结果写入到文件中，而不是在内存中由webpack来处理，这会导致后续loader无法处理`ts-loader`的结果。所以加上`transpileOnly`让它按webpack的操作来，这样后续loader就可以继续处理。\n\n`appendTsSuffixTo`的含义是碰到`.vue`结尾的文件时，加上`.ts`的后缀，这样`ts-loader`就会去处理`.vue`文件中的ts代码。\n\n另外在使用TypeScript编写Vue代码时，可能会碰到一些类型上的问题，可以参见Vue的官方文档：<https://vuejs.org/v2/guide/typescript.html>"
  }
]