Skip to content
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

Word wrap is lost when Yargs is used as ES module #2112

Open
jwbth opened this issue Dec 31, 2021 · 3 comments
Open

Word wrap is lost when Yargs is used as ES module #2112

jwbth opened this issue Dec 31, 2021 · 3 comments
Labels

Comments

@jwbth
Copy link

jwbth commented Dec 31, 2021

Wrapping breaks words at Nth character when Yargs is used as an ES module. As soon as I switch to CommonJS, word wrap is back to normal. That's basically all.

Yargs v17.3.1, Node v14.17.0, Windows 10.

Found a similar issue #1938, it turned out to be a problem of esbuild. It is not used in my case.

@bcoe
Copy link
Member

bcoe commented Dec 31, 2021

@jwbth this was a decision made when migrating to ESM, as the library we used for wordwrap was not yet ported to ESM, I believe we could now go back to using a library that works as expected for ES modules.

Edit: one problem, is I do think the word wrap deps we relied on no longer support CJS 🤔 , perhaps we should consider switching behavior in yargs 18, such that word wrap works as expected for ESM, but not CJS.

Edit 2: I believe the culprit is string-width.

@diksown
Copy link

diksown commented Jun 16, 2022

Any updates on this? I'm getting this behaviour too. (yargs 17.5.1)

@isaacs
Copy link
Contributor

isaacs commented Apr 30, 2023

Fixed by yargs/cliui#139

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants