Skip to content

Fix CommonJS package entry extension and test packed consumers - #421

Closed
vanyathecyborg wants to merge 1 commit into
sparkjsdev:mainfrom
vanyathecyborg:codex/package-cjs
Closed

Fix CommonJS package entry extension and test packed consumers#421
vanyathecyborg wants to merge 1 commit into
sparkjsdev:mainfrom
vanyathecyborg:codex/package-cjs

Conversation

@vanyathecyborg

@vanyathecyborg vanyathecyborg commented Sep 5, 2026

Copy link
Copy Markdown

require('@sparkjsdev/spark') resolves to dist/spark.cjs.js, but the package declares "type": "module". Node therefore treats CommonJS statements in that file as ES-module code: a real .cjs consumer fails instead of receiving Spark exports.

Emit spark.cjs / spark.min.cjs and point main and exports.require at spark.cjs. The ESM/CDN filenames stay unchanged. Add an npm pack consumer test that checks actual CommonJS/ESM exports and the existing synchronous WebGL TypeScript API, including a guard against unresolved any declarations. Linux and Windows CI build the package before testing consumers; distribution builds also watch package/build configuration changes.

Validation from upstream 722255799e26db7cc41c2649638b0aa5214624c6: WASM build, production/development builds, TypeScript, Biome and the upstream unit test pass locally. Packed consumers pass with Node 22.22.0 and 23.10.0, against Three.js 0.180.0 and pinned 0.185.1. TypeScript consumer validation uses browser bundler resolution. No renderer or performance behavior changes are included, and generated distributions are left to the existing build workflow.

Draft until the new Linux/Windows package-consumer checks pass. GitHub currently reports action_required for both first-contributor workflows; maintainer approval is required before they can run.

@vanyathecyborg
vanyathecyborg deleted the codex/package-cjs branch September 6, 2026 12:51
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