Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • 2
    There is no createRequireFromPath - it's createRequire and takes "import.meta.url" as parameter Commented Oct 7, 2021 at 18:09
  • 2
    Unlike the answer above, this works on Windows when you need __dirname, which you might if you're adapting a bunch of code that already uses path.join(__dirname, ...). Commented Apr 15, 2022 at 2:22
  • Top half works first time for my use case when removing node: from the imports Commented May 17, 2022 at 15:22