2015-12-04 3 views
14

Was ist mit dem führenden/******/Kommentare WebPack generiert in der Ausgabe? Soll der WebPack-Code markiert werden, oder gibt es mehr?Warum gibt Webpack vor jeder Zeile seltsame Kommentare aus?

Hier ist eine einfache Ausgabe Beispiel:

/******/ (function(modules) { // webpackBootstrap 
/******/ // The module cache 
/******/ var installedModules = {}; 

/******/ // The require function 
/******/ function __webpack_require__(moduleId) { 

/******/  // Check if module is in cache 
/******/  if(installedModules[moduleId]) 
/******/   return installedModules[moduleId].exports; 

/******/  // Create a new module (and put it into the cache) 
/******/  var module = installedModules[moduleId] = { 
/******/   exports: {}, 
/******/   id: moduleId, 
/******/   loaded: false 
/******/  }; 

/******/  // Execute the module function 
/******/  modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 

/******/  // Flag the module as loaded 
/******/  module.loaded = true; 

/******/  // Return the exports of the module 
/******/  return module.exports; 
/******/ } 


/******/ // expose the modules object (__webpack_modules__) 
/******/ __webpack_require__.m = modules; 

/******/ // expose the module cache 
/******/ __webpack_require__.c = installedModules; 

/******/ // __webpack_public_path__ 
/******/ __webpack_require__.p = ""; 

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

    document.write('I think it works!'); 


/***/ } 
/******/ ]); 
+0

Ja - es markiert den Webpack-Code. –

Antwort

1

Webpack gibt Ihre Module und Brocken-IDs, sie zu identifizieren. Um das Skript zu minimieren, wird empfohlen, das UglifyJs-Plugin (new webpack.optimize.UglifyJsPlugin()) zu verwenden.

Ich empfehle die Seite optimization zu lesen, wo Sie Informationen finden, wie Sie Ihr Skript minimieren und weiter optimieren können.

Verwandte Themen