I have come across a third-party SDK that is structured as an oldschool IIFE based module. The code looks something like this:
var ThirdPartySDK = (function() {
var export = {};
// Adding some methods to export
return export;
})();
To use this SDK, one would typically reference it on the global scope like so:
<html>
<body>
<script src="lib/ThirdPartySDK.js">
<script>
ThirdPartySDK.foo();
<\script>
<\body>
<\html>
While using it in this way is still possible, I am wondering if there is a better approach when working with Angular and TypeScript. Is there a way to configure angular/TypeScript/webpack environment to allow for proper import statements? Such as:
import { ThirdPartySDK } from '../lib/ThirdPartySDK.js';
ThirdPartySDK.foo();