I'm facing an issue where moment.js isn't loading inside a TypeScript file during the webpack4 build process, no matter what I attempt.
[tsl] ERROR in /app/Repository/JFFH.Site/Resources/Private/JavaScript/Angular/schedule/schedule.component.ts(18,30)
npm_1 | TS2694: Namespace '"/app/Repository/JFFH.Site/Resources/Private/node_modules/moment/moment".export=' has no exported member 'Moment'.
Below is the snippet of the TypeScript file that I've been trying to work on:
import * as moment from "moment";
interface IEvent {
title: string;
startTime: string;
startTimeObject?: moment.Moment;
This is my tsconfig.json configuration:
{
"compilerOptions": {
"outDir": "./dist/",
"noImplicitAny": true,
"module": "es6",
"target": "es5",
"jsx": "react",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"allowJs": true
}
}
And here are the rules I have set up in Webpack4:
{
test: /\.tsx?$/,
exclude: [/node_modules/, /Packages/],
use: {
loader: 'ts-loader'
}
},
{
test: /\.js$/,
exclude: [/core-js/, /@babel\/runtime/],
use: {
loader: 'babel-loader'
}
},