2016-04-03 70 views
2

をコメントアウトビルド:WebPACKの私は非常に簡単な設定でのWebPACKを使用し、バンドル

module.exports = { 
    entry: './index.js', 
    output: { 
    path: __dirname, 
    filename: 'bundle.js' 
    }, 
    module: { 
    loaders: [ 

     { 
     test: /\.jsx?$/, 
     loader: 'babel', 
     exclude: /node_modules/, 
     query: { 
      presets: [ 
      'es2015', 
      'stage-0', 
      'react' 
      ] 
     } 
     } 

    ] 
    } 
} 

webpackまたはwebpack-dev-server実行すると、これはbundle.js得られます。これらのコメントはどこ

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

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

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

/******/  // Create a new module (and put it into the cache) 
/******/  var module = installedModules[moduleId] = { 
/******/   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) { 

    'use strict'; 

    alert('test'); 

/***/ } 
/******/ ]); 

から来るのでしょうか?

答えて

2

これらのコメントはWebpack自体からのものです。 webpack-dev-serverはあなたのモジュールをフォルダにバンドルしますが、webpack-dev-serverを実行しているときは縮小は適用されません。生産では、完全に細分化が適用されると、これらのコメントは追加されません。

+0

バンドルを縮小せずにコメントを削除する必要があるのはどうですか?出来ますか? – darksoulsong

関連する問題