I am working on a TypeScript file that utilizes the moment library, and I need to import moment for it to compile properly. However, after compilation, the import line is still present in the compiled file, which is causing issues on my web page.
Here is an excerpt from my tsconfig file:
{
"compileOnSave": true,
"compilerOptions": {
"lib": [
"es2015",
"dom"
],
"module": "es2015",
"moduleResolution": "node",
"noEmitOnError": true,
"outDir": "Assets/Scripts/lib",
"pretty": true,
"removeComments": true,
"rootDir": "tsSrc",
"target": "es5",
"sourceMap": true
},
"exclude": [
"node_modules",
"tsSrc/typescript-definitions"
]
}
Below is an example of how moment is being used in the code:
/// <reference path="../../../node_modules/moment/moment.d.ts" />
import * as moment from "moment";
console.log(moment().format("M/D/YYYY h:mm a"));