Skip to content

Unable to require .ts nested within a node_modules directory #956

@underflow00

Description

@underflow00

Expected Behavior

No errors.

Actual Behavior

"Unable to require file" error.

Steps to reproduce the problem

  1. Create a package (e.g. using npm pack) with the following files:
  • npm-postinstall.ts:
console.log('hello');
import * as x from './x';
console.log('hello2', typeof x);
  • package.json:
{
  "name": "package1",
  "version": "0.0.0",
  "scripts": {
    "postinstall": "ts-node --skip-ignore npm-postinstall"
  },
  "dependencies": {
    "ts-node": "^8.6.2",
    "typescript": "^3.7.5"
  }
}
  • x.ts:
export const x = 1;
  1. Install that package: npm install package1-0.0.0.tgz

Works fine on Windows

Specifications

  • ts-node version: 8.6.2
  • node version: 12.15.0
  • Operating system and version: Ubuntu
  • If Windows, are you using WSL or WSL2?:

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