I currently have a Typescript web project (2.1.6) compiled using Webpack in VScode. I am incorporating a third-party logging client which I am attempting to upload to NPM and use as a regular dependency.
The existing logging client was originally written in the "old" Typescript syntax with outdated modules, so I refactored it to utilize the import/export syntax. When compiling the refactored code, I am setting the module flag to "umd" and targeting ES5 as the script version. Additionally, I am generating a single d.ts file for the logging client using the dts-generator npm package.
Here is a basic overview of how the Logger.ts file looks after the refactor:
import { LoggerSettings } from "./LoggerSetting";
import { AjaxRequest } from "./AjaxRequest";
// ... more code here
export class Logger {
// Implementation details
}
The generated d.ts file includes declarations for LoggerSettings and Logger under the "logging-client" module as shown below:
declare module "logging-client" {
export class LoggerSettings {
// ...
}
}
declare module "logging-client" {
export class Logger {
// ...
}
}
In the package.json file, the configuration looks like this:
{
"name": "logging-client",
"main": "Logger.js",
"types": "logging-client.d.ts"
}
However, when trying to import the Logger into my Typescript code, I encounter an error stating "can't find the logging-client module".
How should I go about diagnosing and resolving this issue? Am I missing something in my setup?
Thank you in advance, Avi :)
EDIT: For those interested, here's a link to the git repository showcasing the problem: https://github.com/avrahams1/LogError