A function that returns the normally hidden `AsyncFunction` constructor
by ljharbJavaScript
Last 12 weeks · 0 commits
4 of 6 standards met
ESM imports require a file extension. Also directory imports don’t resolve to . This goes for source code as well as type definitions. Modern module resolution settings validate this. The correct value for libraries that target Node.js 16 or lower is . For libraries that target Node.js 18 or greater should set it to or . For code that gets bundled, the correct option is . All other options are outdated. The config in sets this correctly, but it contains a syntax error.
Here’s a rough example of a basic import and call. When importing this library (using the code above) and attempting to execute the script via , the following fatal error occurs: This was done on Node.js and . Note that the error does NOT occur when the following is present in . I only realized that specifying the as fixes the issue when I tried to run the same code via . requires that the is set to for it to run and when set, it runs without an error. Perhaps this is not an issue with at all! I just wanted to mention the issue and my findings here from https://github.com/ljharb/get-intrinsic/issues/23 just in case. Please feel free to close this otherwise as it may be a simple and obvious misconfiguration. Thank you!
Repository: ljharb/async-function. Description: A function that returns the normally hidden `AsyncFunction` constructor Stars: 3, Forks: 4. Primary language: JavaScript. Languages: JavaScript (96.4%), TypeScript (3.6%). License: MIT. Open PRs: 1, open issues: 0. Last activity: 4mo ago. Community health: 85%. Top contributors: ljharb, EduardoRFS, connorshea.