Skip to content

Cannot find module log4js with TypeScript #1009

@bbohec

Description

@bbohec

log4js installed as dependency through npm.

tsconfig.json using module:esnext
package.json using type:module

Not working :

import log4js = require("log4js");
//Import assignment cannot be used when targeting ECMAScript modules. Consider using 'import * as ns from "mod"', 'import {a} from "mod"', 'import d from "mod"', or another module format instead.
import * as log4js from "log4js";
//Cannot find module 'log4js'

Current workaround:

import * as log4js from "../../../node_modules/log4js/types/log4js";

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions