3

I use webpack with a very simple config:

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' ] } } ] } } 

Running webpack or webpack-dev-server yields this 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'); /***/ } /******/ ]); 

Where does these comments come from?

1 Answer 1

2

These comments come from Webpack itself. While webpack-dev-server will bundle your modules into folders, minification isn't applied when you're running webpack-dev-server. In production, when full minification is applied, these comments wouldn't be added.

Sign up to request clarification or add additional context in comments.

1 Comment

And what about if I just need to remove the comments without minifying the bundle? Is it possible?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.