I'm developing an Angular Spa (using Angular CLI) and I would like to have moment.js included in the page as an external script:
<script src="/lib/moment.min.js"></script>
This, because I want to move the loading of only the relevant locales to the server side, and having moment.js out of the build is the first step.
So, I need to make the rest of the build to work using this import mechanism, ideally keeping Moment.js typings somewhat working. Something like:
declare const moment: moment.MomentType;
// or something like
interface Window {
moment: moment.MomentType
}
This syntax (or any variation of it I can come up) keeps me getting errors along the lines of Cannot find namespace 'moment'.
I already tried to remove every import { moment } from 'moment'; around, I tried variations of declare const moment: any;, but they don't give me type safety, and I can't find a way to import moment.d.ts, either via tsconfig "files" property or in the project's tsconfig.app.json "include" property.
Is there a way to make this work?
Thanks!

