title: Uncaught TypeError: Cannot read property 'parse' of undefined when requiring a library
body: <p>I'm using angular 5, I'm trying to use a javascript file that hold some methods that use a library from docuvieware. I ended up using javascript since I was unable to use it on typescript. So I have the following code:</p>
  
  <pre><code>const { docuVieware } = require('../../../docuvieware/docuvieware-min');
  
  module.exports = { loadFile: 
      function loadFile(file) {
      if (file != null) {
          var params = {
              Value: file,
              Example: false
          };
          docuVieware.DocuViewareAPI.PostCustomServerAction("DocuVieware1", 
   true, "loadFile", params, function(result){ console.log("result: " + 
   JSON.stringify(result)); });
      }
    }
  };
  </code></pre>
  
  <p>But whenever I open my browser I get the following error:</p>
  
  <pre><code>&gt; docuvieware-min.js:166 Uncaught TypeError: Cannot read property 'parse' of undefined
      at eval (docuvieware-min.js:166)
      at eval (docuvieware-min.js:20)
      at Object.eval (docuvieware-min.js:20)
      at eval (docuvieware-min.js:1128)
      at Object../src/docuvieware/docuvieware-min.js (main.bundle.js:208)
      at __webpack_require__ (inline.bundle.js:55)
      at eval (docuvieware.js:1)
      at Object../src/app/components/detalleExpediente/docuvieware.js (main.bundle.js:128)
      at __webpack_require__ (inline.bundle.js:55)
      at eval (detalleExpediente.component.ts:7)
  </code></pre>
  
  <p>So, if I comment the require line the error disappears but I need it. Any idea why I get this error? Thanks in advance for the help.</p>