'ES6 Modules : Importing a module in an Angular component

I have an ES6 module where I am exporting a library. I want to be able to use this module in an Angular component. I cannot have the library files locally within my Angular app, neither can I publish the library as an NPM package.

Can I host the module in a dev server, and use the server URL to import the module in my Angular component?

I tried things like

component.ts

import * as lib from "...url";

or adding this in index.html

<script src = "..url"/>

Neither of them have worked. What can I try next?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source