Skip to content

feat(yargs): update yargs to 18.0.0 - #1671

Closed
oldium wants to merge 2 commits into
firecow:masterfrom
oldium:feature/yargs-update
Closed

feat(yargs): update yargs to 18.0.0#1671
oldium wants to merge 2 commits into
firecow:masterfrom
oldium:feature/yargs-update

Conversation

@oldium

@oldium oldium commented Oct 28, 2025

Copy link
Copy Markdown

New yargs version bundling is failing, because it is newly ESM-only module:

  • It is not included in esbuild and pkg does not patch ESM import paths.
  • If added into esbuild, the transpiled import.meta.url is empty and execution fails.

Fix this by letting esbuild transpile also yargs to CJS, but provide a sensible value for import.meta.url as mentioned in the esbuild bug report.

While at it, also update @yao-pkg/pkg to support newer Node.js runtime.

Supercedes: #1577

@oldium
oldium force-pushed the feature/yargs-update branch 2 times, most recently from 4291322 to 9d91f95 Compare October 28, 2025 18:35
New `yargs` version bundling is failing, because it is newly ESM-only
module:

 * It is not included in `esbuild` and `pkg` does not patch [ESM import
   paths][1].
 * If added into `esbuild`, the transpiled `import.meta.url` is empty and
   execution fails.

Fix this by letting `esbuild` transpile also `yargs` to CJS, but provide a
sensible value for `import.meta.url` as mentioned in the `esbuild` [bug
report][2].

While at it, also update `@yao-pkg/pkg` to support newer Node.js runtime.

[1]: yao-pkg/pkg#16 (comment)
[2]: evanw/esbuild#2441 (comment)

Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
@oldium
oldium force-pushed the feature/yargs-update branch from 9d91f95 to 2e077a7 Compare October 28, 2025 18:36
@oldium

oldium commented Oct 28, 2025

Copy link
Copy Markdown
Author

Ha! The yargs locales are probably missing due to this.

@oldium

oldium commented Oct 28, 2025

Copy link
Copy Markdown
Author

Hm. I am able to get also locales working locally, but when packed with pkg, the --help option gets to segmentation fault... I have no solution for this.

@oldium

oldium commented Oct 28, 2025

Copy link
Copy Markdown
Author

I will leave it here in this state, feel free to close it if you do not want to continue on it.

@oldium

oldium commented Oct 28, 2025

Copy link
Copy Markdown
Author

Maybe try Node.js experimental Single Executable Applications?

@firecow

firecow commented Feb 17, 2026

Copy link
Copy Markdown
Owner

We've started using bun. So yargs 18 is coming soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants