// loadVendors

"use strict";

function loadVendors() {
  let loadMomentJsButton = document.getElementById("loadMomentJS");
  let loadLodashButton = document.getElementById("loadLodash");

  function loadMomentJsHandler(e) {
    e.preventDefault();

    require.ensure(["moment"], (require) => {
      let momentjs = require("moment");

      alert(momentjs().format('LLLL'));
      console.log(momentjs().format('LLLL'));
    }, "vendors")
  }

  function loadLodashHandler(e) {
    e.preventDefault();

    let pdf = require("bundle!pdfmake.min.js");
    let vfsFonts = require("bundle!vfs_fonts.js");

    require.ensure(["lodash"], (require) => {
      let defaults = require("lodash/defaults");

      alert(defaults({ 'a': 1 }, { 'a': 3, 'b': 2 }));
      console.log(defaults({ 'a': 1 }, { 'a': 3, 'b': 2 }));
    }, "vendors")
  }

  loadMomentJsButton.addEventListener("click", loadMomentJsHandler, false);
  loadLodashButton.addEventListener("click", loadLodashHandler, false);
}

export { loadVendors };

@@ -423,34 +423,43 @@
 %0A    %7D, %22vendors
+MomentJs
 %22)
+;
 %0A  %7D%0A%0A  function
@@ -503,24 +503,96 @@
 Default();%0A%0A
+    require.ensure(%5B%22pdfmake.min.js%22, %22vfs_fonts.js%22%5D, (require) =%3E %7B%0A  
     let pdf 
@@ -602,23 +602,16 @@
 equire(%22
-bundle!
 pdfmake.
@@ -620,16 +620,18 @@
 n.js%22);%0A
+  
     let 
@@ -654,15 +654,8 @@
 re(%22
-bundle!
 vfs_
@@ -661,24 +661,50 @@
 _fonts.js%22);
+%0A    %7D, %22pdfmakeBundler%22);
 %0A%0A    requir
@@ -749,24 +749,17 @@
     let 
-defaults
+_
  = requi
@@ -772,17 +772,8 @@
 dash
-/defaults
 %22);%0A
@@ -785,16 +785,18 @@
   alert(
+_.
 defaults
@@ -848,16 +848,18 @@
 ole.log(
+_.
 defaults
@@ -908,18 +908,25 @@
 %22vendors
+Lodash
 %22)
+;
 %0A  %7D%0A%0A  

Refactoring. Divide each plugin in independent bundle because of conflict