-
Notifications
You must be signed in to change notification settings - Fork 995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import "yargs/yargs"
in esm code brings in __dirname
(when compiled using ncc)
#2418
Comments
import "yargs/yargs" in esm code brings in
__dirname`import "yargs/yargs"
in esm code brings in __dirname
I was able to reproduce the failure. My guess is ncc is getting confused resolving subpath exports. I got a working build using the main entry point: import yargsFactory from "yargs";
console.log(yargsFactory(process.argv.slice(2)).parse()); |
Thank you for verifying this! I feel I ran into this because
What's you recommended next step for this? |
I suggest try changing your project to use commonjs. That might avoid triggering the problem with the ncc compile. |
Got it. I'll leave the issue open in case someone else ran into this. |
import "yargs/yargs"
in esm code brings in __dirname
import "yargs/yargs"
in esm code brings in __dirname
(when compiled using ncc)
Reproduce
Create
package.json
andindex.mjs
with following code:Run command:
Exepcted
Actual
I think this has something to do with
yargs.mjs
importingbuild/index.cjs
, but have no clue on how to solve it.The text was updated successfully, but these errors were encountered: