-
Notifications
You must be signed in to change notification settings - Fork 991
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)
Hello, I have the same problem when using puppeteer My Express (Angular SSR) application compiles successfully, but an error appears on startup
|
To be clear, are you also compiling using |
I noticed this issue being mentioned in puppeteer/puppeteer#13249, and the fix (work-around) was to use the "old" import:
That might help track down the underlying trigger with a working case and a broken case, but even without solving it, there is hopefully a work-around. |
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: