0

Yarn berry (v2) got rid of node_modules (which I really love) by introducing pnp. However, scripts executed by node directly don't understand pnp modules, so you have to use yarn to run such a script.

Is there some way (e.g. a require script like ts-node provides) so that I can still use node to launch my script that requires pnp modules?

Background is that I want to configure the Mocha Sidebar extension for VS Code to support pnp. I can add configure node options there and specify files that are required automatically.

CoryCoolguy
  • 1,065
  • 8
  • 18
Henning
  • 579
  • 6
  • 17
  • Also, I don't mean `yarn node myscript.js`. Ideally I want to keep node as the binary and just use a require script. – Henning Apr 28 '20 at 08:39

1 Answers1

0

That's the (undocumented) solution:

require(".pnp.js").setup();
Henning
  • 579
  • 6
  • 17