Skip to content

How does readFile option work? #736

@thetutlage

Description

@thetutlage

I have been searching Typescript documentation and also other opened issues in this repo. Have not been able to find how exactly readFile option works

If I use the following code

require('ts-node').register({
  readFile: function foo (file) {
    console.log({ readFile: file })
    return typescript.sys.readFile(file)
  },
})

It does resolve initial files like tsconfig or type definitions. However, the import statements of my application code are not getting through this function?

Do they go directly to Node.js require or how exactly it works?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions