title: Call "new" on my class in my libs after webpack.js build
body: <p>I try to figuring out how to call new after webpack.js build final index.js
  I build my own lib, and it's work. But now I want to minify and use it in other project.</p>
  <p>myLib.js</p>
  <pre><code>export default class MyClass {
      constructor(milan) {
          this.milan = milan;
      }
  
      loging(options) {
          console.log('finaly')
      }
  }
  </code></pre>
  <p>index.js</p>
  <pre><code>import MyClass from &quot;./myLib&quot;;
  
  export {MyClass};
  </code></pre>
  <p>my index.min.js looks like this.</p>
  <pre><code>/*
   * ATTENTION: The &quot;eval&quot; devtool has been used (maybe by default in mode: &quot;development&quot;).
   * This devtool is not neither made for production nor for readable output files.
   * It uses &quot;eval()&quot; calls to create a separate source file in the browser devtools.
   * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/)
   * or disable the default devtool with &quot;devtool: false&quot;.
   * If you are looking for production-ready output files, see mode: &quot;production&quot; (https://webpack.js.org/configuration/mode/).
   */
  /******/ (() =&gt; { // webpackBootstrap
  /******/    &quot;use strict&quot;;
  /******/    var __webpack_modules__ = ({
  
  /***/ &quot;./src/js/dropdown.js&quot;:
  /*!****************************!*\
    !*** ./src/js/dropdown.js ***!
    \****************************/
  /*! namespace exports */
  /*! export default [provided] [no usage info] [missing usage info prevents renaming] */
  /*! other exports [not provided] [no usage info] */
  /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) =&gt; {
  
  eval(&quot;__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \&quot;default\&quot;: () =&gt; /* binding */ Dropdown\n/* harmony export */ });\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\&quot;Cannot call a class as a function\&quot;); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i &lt; props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\&quot;value\&quot; in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar Dropdown = /*#__PURE__*/function () {\n  function Dropdown(dropdownObject) {\n    _classCallCheck(this, Dropdown);\n\n    this.dropdownObject = dropdownObject;\n    this.values = null;\n    this.allowSearch = false;\n    this.allowMultiple = false;\n  }\n\n  _createClass(Dropdown, [{\n    key: \&quot;selectable\&quot;,\n    value: function selectable(options) {\n      var _this2 = this;\n\n      if (options !== undefined) {\n        this.allowSearch = options.allowSearch;\n        this.allowMultiple = options.allowMultiple;\n      }\n\n      var dropdownObject = this.dropdownObject;\n      var dropdownMenu = this.dropdownObject.querySelector('.menu');\n      var items = dropdownMenu.getElementsByClassName('item');\n      items = Array.from(items);\n      var text = this.dropdownObject.querySelector('.text');\n      var input = null;\n      var filter = '';\n\n      if (this.allowMultiple) {\n        this.values = [];\n        this.dropdownObject.classList.add('dropdown_multiple');\n      }\n\n      var filtering = function filtering() {\n        text.insertAdjacentHTML('beforebegin', '&lt;input type=\&quot;text\&quot; class=\&quot;dropdown_input\&quot;&gt;');\n        input = dropdownObject.querySelector('.dropdown_input');\n        input.addEventListener('keyup', function () {\n          _this2.dropdownObject.classList.add('active');\n\n          dropdownMenu.classList.add('visible');\n          filter = input.value.toLowerCase();\n          var inputWidth = (filter.length + 8) * 8;\n          _this2.dropdownObject.querySelector('.dropdown_input').style.width = inputWidth + \&quot;px\&quot;;\n\n          if (filter === '') {\n            input.parentNode.querySelector('.text').classList.remove('filtered');\n          } else {\n            input.parentNode.querySelector('.text').classList.add('filtered');\n          }\n\n          var tmpItems = Array.from(items);\n\n          if (Array.isArray(_this2.values)) {\n            _this2.values.map(function (selected) {\n              var _loop = function _loop(_i) {\n                if (selected === items[_i].getAttribute('data-value')) {\n                  tmpItems = tmpItems.filter(function (tmpItem) {\n                    return tmpItem !== items[_i];\n                  });\n                }\n              };\n\n              for (var _i = 0; _i &lt; items.length; _i++) {\n                _loop(_i);\n              }\n            });\n          }\n\n          tmpItems.map(function (tmpItem) {\n            var selectTempText = tmpItem.textContent;\n\n            if (selectTempText.toLowerCase().indexOf(filter) &gt; -1) {\n              for (var _i2 = 0; _i2 &lt; items.length; _i2++) {\n                if (tmpItem === items[_i2]) {\n                  items[_i2].classList.remove('filtered');\n                }\n              }\n            } else {\n              for (var _i3 = 0; _i3 &lt; items.length; _i3++) {\n                if (tmpItem === items[_i3]) {\n                  items[_i3].classList.add('filtered');\n                }\n              }\n            }\n          });\n          var i = 0;\n          items.map(function (item) {\n            if (item.classList.contains('filtered')) {\n              i++;\n            }\n          });\n          var notFound = dropdownMenu.querySelector('.message');\n\n          if (items.length === i) {\n            if (notFound === null) {\n              var div = document.createElement('div');\n              div.classList.add('message');\n\n              var _text = document.createTextNode('No results found.');\n\n              div.appendChild(_text);\n              dropdownMenu.appendChild(div);\n            }\n          } else {\n            if (notFound !== null) {\n              dropdownMenu.removeChild(notFound);\n            }\n          }\n        });\n      };\n\n      if (this.allowSearch) {\n        filtering();\n        this.dropdownObject.classList.add('dropdown_search');\n      }\n\n      var openMenuHandler = function openMenuHandler() {\n        var dropdowns = document.querySelectorAll('.dropdown');\n\n        for (var _i4 = 0; _i4 &lt; dropdowns.length; _i4++) {\n          if (dropdownObject !== dropdowns[_i4]) {\n            dropdowns[_i4].classList.remove('active');\n\n            dropdowns[_i4].querySelector('.menu').classList.remove('visible');\n          }\n        }\n\n        var i = 0;\n        items.map(function (item) {\n          if (item.classList.contains('filtered')) {\n            i++;\n          }\n        });\n\n        if (_this2.allowSearch) {\n          _this2.dropdownObject.querySelector('.dropdown_input').focus();\n        }\n\n        if (!_this2.allowSearch &amp;&amp; !_this2.allowMultiple) {\n          _this2.dropdownObject.classList.toggle('active');\n\n          dropdownMenu.classList.toggle('visible');\n        } else {\n          _this2.dropdownObject.classList.add('active');\n\n          dropdownMenu.classList.add('visible');\n          var tmpItems = Array.from(items);\n\n          if (Array.isArray(_this2.values)) {\n            _this2.values.map(function (selected) {\n              var _loop2 = function _loop2(_i5) {\n                if (selected === items[_i5].getAttribute('data-value')) {\n                  tmpItems = tmpItems.filter(function (tmpItem) {\n                    return tmpItem !== items[_i5];\n                  });\n                }\n              };\n\n              for (var _i5 = 0; _i5 &lt; items.length; _i5++) {\n                _loop2(_i5);\n              }\n            });\n          }\n\n          var message = _this2.dropdownObject.querySelector('.message');\n\n          if (message !== null) {\n            message.remove();\n          }\n\n          for (var _i6 = 0; _i6 &lt; items.length; _i6++) {\n            items[_i6].classList.add('filtered');\n          }\n\n          if (filter === '') {\n            tmpItems.map(function (tmpItem) {\n              for (var _i7 = 0; _i7 &lt; items.length; _i7++) {\n                if (tmpItem === items[_i7]) {\n                  items[_i7].classList.remove('filtered');\n                }\n              }\n            });\n          } else {\n            if (items.length === i) {\n              var div = document.createElement('div');\n              div.classList.add('message');\n\n              var _text2 = document.createTextNode('No results found.');\n\n              div.appendChild(_text2);\n              dropdownMenu.appendChild(div);\n            }\n\n            tmpItems.map(function (tmpItem) {\n              var selectTempText = tmpItem.textContent;\n\n              if (selectTempText.toLowerCase().indexOf(filter) &gt; -1) {\n                for (var _i8 = 0; _i8 &lt; items.length; _i8++) {\n                  if (tmpItem === items[_i8]) {\n                    items[_i8].classList.remove('filtered');\n                  }\n                }\n              } else {\n                for (var _i9 = 0; _i9 &lt; items.length; _i9++) {\n                  if (tmpItem === items[_i9]) {\n                    items[_i9].classList.add('filtered');\n                  }\n                }\n              }\n            });\n          }\n        }\n      };\n\n      this.dropdownObject.addEventListener('click', function (e) {\n        e.stopPropagation();\n        openMenuHandler();\n      });\n      document.addEventListener('click', function (e) {\n        var message = _this2.dropdownObject.querySelector('.message');\n\n        if (message !== null) {\n          message.remove();\n        }\n\n        if (_this2.allowSearch) {\n          input.value = '';\n          filter = '';\n\n          for (var i = 0; i &lt; items.length; i++) {\n            items[i].classList.remove('filtered');\n          }\n\n          input.parentNode.querySelector('.text').classList.remove('filtered');\n        }\n\n        if (_this2.allowSearch &amp;&amp; _this2.allowMultiple) {\n          _this2.values.map(function (selected) {\n            for (var _i10 = 0; _i10 &lt; items.length; _i10++) {\n              if (selected === items[_i10].getAttribute('data-value')) {\n                items[_i10].classList.add('filtered');\n              }\n            }\n          });\n        }\n\n        if (e.target !== dropdownObject) {\n          dropdownObject.classList.remove('active');\n          dropdownMenu.classList.remove('visible');\n\n          if (_this2.dropdownObject.querySelector('.dropdown_input') !== null) {\n            _this2.dropdownObject.querySelector('.dropdown_input').style.width = 16 + \&quot;px\&quot;;\n          }\n        }\n      });\n\n      var removeItemHandler = function removeItemHandler() {\n        var removeButtons = document.getElementsByClassName('fa-times');\n\n        for (var i = 0; i &lt; removeButtons.length; i++) {\n          removeButtons[i].addEventListener('click', function (e) {\n            e.target.parentNode.remove();\n\n            for (var _i11 = 0; _i11 &lt; items.length; _i11++) {\n              if (items[_i11].getAttribute('data-value') === e.target.parentNode.getAttribute('data-value')) {\n                items[_i11].classList.remove('filtered');\n\n                _this2.values = _this2.values.filter(function (value) {\n                  return value !== e.target.parentNode.getAttribute('data-value');\n                });\n              }\n            }\n\n            var i = 1;\n            items.map(function (item) {\n              if (item.classList.contains('filtered')) {\n                i++;\n              }\n            });\n\n            if (items.length === i) {\n              var message = _this2.dropdownObject.querySelector('.message');\n\n              if (message !== null) {\n                message.remove();\n              }\n            }\n          });\n        }\n      };\n\n      var addItemsHandler = function addItemsHandler(e) {\n        var _this = e.target;\n\n        if (_this2.allowMultiple) {\n          _this2.values.push(e.target.getAttribute('data-value'));\n\n          _this.classList.add('filtered');\n\n          var child = _this.cloneNode(true);\n\n          var nodePLace = dropdownObject.childNodes.length;\n          dropdownObject.insertBefore(child, dropdownObject.childNodes[nodePLace - 5]);\n          child.insertAdjacentHTML('beforeend', \&quot;&lt;i class=\\\&quot;fas fa-times\\\&quot;&gt;&lt;/i&gt;\&quot;);\n          child.classList.add('label');\n          var i = 0;\n          items.map(function (item) {\n            if (item.classList.contains('filtered')) {\n              i++;\n            }\n          });\n\n          if (items.length === i) {\n            _this2.dropdownObject.classList.remove('active');\n\n            dropdownMenu.classList.remove('visible');\n          }\n\n          removeItemHandler();\n        } else {\n          _this2.values = _this.getAttribute('data-value');\n\n          _this.parentElement.querySelectorAll('.selected').forEach(function (e) {\n            return e.classList.remove('selected');\n          });\n\n          _this.classList.add('selected');\n\n          dropdownObject.classList.remove('active');\n          dropdownMenu.classList.remove('visible');\n          text.innerHTML = \&quot;\&quot;;\n\n          var _child = _this.cloneNode(true);\n\n          text.appendChild(_child);\n        }\n\n        if (_this2.allowSearch) {\n          input.parentNode.querySelector('.text').classList.remove('filtered');\n          input.value = '';\n          filter = '';\n\n          _this2.dropdownObject.querySelector('.dropdown_input').focus();\n        }\n      };\n\n      for (var i = 0; i &lt; items.length; i++) {\n        items[i].addEventListener(\&quot;click\&quot;, function (e) {\n          e.stopPropagation();\n          addItemsHandler(e);\n        });\n      }\n    }\n  }, {\n    key: \&quot;getValue\&quot;,\n    value: function getValue() {\n      return this.values;\n    }\n  }]);\n\n  return Dropdown;\n}();\n\n\n\n//# sourceURL=webpack://imp_design/./src/js/dropdown.js?&quot;);
  
  /***/ }),
  
  /***/ &quot;./src/js/index.js&quot;:
  /*!*************************!*\
    !*** ./src/js/index.js ***!
    \*************************/
  /*! namespace exports */
  /*! export Dropdown [provided] [no usage info] [missing usage info prevents renaming] -&gt; ./src/js/dropdown.js .default */
  /*! other exports [not provided] [no usage info] */
  /*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.d, __webpack_require__.r, __webpack_require__.* */
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) =&gt; {
  
  eval(&quot;__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */   \&quot;Dropdown\&quot;: () =&gt; /* reexport safe */ _dropdown__WEBPACK_IMPORTED_MODULE_0__.default\n/* harmony export */ });\n/* harmony import */ var _dropdown__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./dropdown */ \&quot;./src/js/dropdown.js\&quot;);\n\n\n\n//# sourceURL=webpack://imp_design/./src/js/index.js?&quot;);
  
  /***/ }),
  
  /***/ &quot;./src/scss/imp_design.scss&quot;:
  /*!**********************************!*\
    !*** ./src/scss/imp_design.scss ***!
    \**********************************/
  /*! namespace exports */
  /*! exports [not provided] [no usage info] */
  /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) =&gt; {
  
  eval(&quot;__webpack_require__.r(__webpack_exports__);\n// extracted by mini-css-extract-plugin\n\n\n//# sourceURL=webpack://imp_design/./src/scss/imp_design.scss?&quot;);
  
  /***/ })
  
  /******/    });
  /************************************************************************/
  /******/    // The module cache
  /******/    var __webpack_module_cache__ = {};
  /******/    
  /******/    // The require function
  /******/    function __webpack_require__(moduleId) {
  /******/        // Check if module is in cache
  /******/        if(__webpack_module_cache__[moduleId]) {
  /******/            return __webpack_module_cache__[moduleId].exports;
  /******/        }
  /******/        // Create a new module (and put it into the cache)
  /******/        var module = __webpack_module_cache__[moduleId] = {
  /******/            // no module.id needed
  /******/            // no module.loaded needed
  /******/            exports: {}
  /******/        };
  /******/    
  /******/        // Execute the module function
  /******/        __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  /******/    
  /******/        // Return the exports of the module
  /******/        return module.exports;
  /******/    }
  /******/    
  /************************************************************************/
  /******/    /* webpack/runtime/define property getters */
  /******/    (() =&gt; {
  /******/        // define getter functions for harmony exports
  /******/        __webpack_require__.d = (exports, definition) =&gt; {
  /******/            for(var key in definition) {
  /******/                if(__webpack_require__.o(definition, key) &amp;&amp; !__webpack_require__.o(exports, key)) {
  /******/                    Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  /******/                }
  /******/            }
  /******/        };
  /******/    })();
  /******/    
  /******/    /* webpack/runtime/hasOwnProperty shorthand */
  /******/    (() =&gt; {
  /******/        __webpack_require__.o = (obj, prop) =&gt; Object.prototype.hasOwnProperty.call(obj, prop)
  /******/    })();
  /******/    
  /******/    /* webpack/runtime/make namespace object */
  /******/    (() =&gt; {
  /******/        // define __esModule on exports
  /******/        __webpack_require__.r = (exports) =&gt; {
  /******/            if(typeof Symbol !== 'undefined' &amp;&amp; Symbol.toStringTag) {
  /******/                Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  /******/            }
  /******/            Object.defineProperty(exports, '__esModule', { value: true });
  /******/        };
  /******/    })();
  /******/    
  /************************************************************************/
  /******/    // startup
  /******/    // Load entry module
  /******/    __webpack_require__(&quot;./src/scss/imp_design.scss&quot;);
  /******/    // This entry module used 'exports' so it can't be inlined
  /******/    __webpack_require__(&quot;./src/js/index.js&quot;);
  /******/    __webpack_require__(&quot;./src/js/dropdown.js&quot;);
  /******/ })()
  ;
  </code></pre>
  <p>webpack.config.js</p>
  <pre><code>const path = require('path');
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
  const { CleanWebpackPlugin } = require('clean-webpack-plugin');
  
  module.exports = {
      entry: {
          index: [
              './src/scss/imp_design.scss',
              './src/js/index.js',
              './src/js/Mylib.js'
          ],
      },
      output: {
          path: path.resolve(__dirname, './dist'),
          filename: '[name].min.js'
      },
      module: {
          rules: [
              {
                  test: /\.scss$/,
                  exclude: /node_modules/,
                  use: [
                      MiniCssExtractPlugin.loader,
                      'css-loader',
                      'sass-loader'
                  ]
              },
              {
                  test: /\.(eot|svg|ttf|woff|woff2)$/,
                  exclude: /node_modules/,
                  loader: 'file-loader',
                  options: {
                      publicPath: './',
                      name: '[name].[ext]'
                  }
              },
              {
                  test: /\.(js)$/,
                  exclude: /node_modules/,
                  use: &quot;babel-loader&quot;,
              }
          ]
      },
      plugins: [
          new CleanWebpackPlugin(),
          new MiniCssExtractPlugin({
              filename: '[name].min.css'
          })
      ]
  }
  </code></pre>
  <p>some.js</p>
  <pre><code> import MyClas from 'index.min.js'
   let myClass = new MyClass(&quot;someValue&quot;);
   myClass.loging();
  </code></pre>
  <p>And error from console is &quot;Uncaught ReferenceError: MyClass is not defined&quot;.</p>
  <p>I try with require and</p>
  <pre><code>  library: 'webpackNumbers',
    libraryTarget: 'umd',
  </code></pre>
  <p>Of Course everything works nice without webpack. But I want now to minimize code and no luck.</p>