Skip to content

fix(build): externalize node:-prefixed builtins in CLI build - #280

Open
dimzon wants to merge 1 commit into
pieroxy:masterfrom
dimzon:fix/node-builtins-external
Open

dimzon wants to merge 1 commit into
pieroxy:masterfrom
dimzon:fix/node-builtins-external

Conversation

@dimzon

@dimzon dimzon commented Nov 30, 2026

Copy link
Copy Markdown

The CLI build bundles commander@12, which imports Node builtins with the node: prefix (node:events, node:child_process, ...). vite.config.cli.mts only listed the bare names in rollupOptions.external, so Vite replaced the prefixed imports with browser stubs. The generated bin/cli.cjs then crashed with TypeError: Class extends value undefined is not a constructor or null (EventEmitter undefined) when the test suite invoked it.

Adding /^node:/ to external keeps all Node builtins external, so the CLI uses the real modules at runtime.

Verified: npm run build, test.sh js and test.sh cjs pass; full CI in the fork is green (https://github.com/dimzon/lz-string/actions/runs/46346788605).

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.

1 participant