Module not found error in TypeScript/JavaScript

Viewed 205

I'm trying to import a function from a .js file into my .ts file. I'm getting error module not found. I've verified few properties in my ts.config file. They seem to be OK. like allowJs = True.

Note: .js file is present in different package & i've provided the correct path while importing.

Anyone faced this issue before? Or is there anything special that i need to take care of while importing a .js function into .ts file.

JSFile.js

module.exports = xyz => {

  const getJSFunction = async (
    param1,
    param2,
    param3,
    options = {}
  ) => {---Method Body---};

TSFile.ts

const abc = require('../../folder/JSFile');

Getting error module ../../folder/JSFile not found

Thanks in advance !!!

0 Answers
Related