feat(build): dual CJS/ESM output for all packages#517
Conversation
Each package now emits both CommonJS and ESM builds via separate tsconfig configs, with conditional exports in publishConfig so consumers can require() or import any package. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e1b88a3acf
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
cashd
left a comment
There was a problem hiding this comment.
thank you! I would also explore using sideEffects: false in the package.json files. This will help inform bundlers to tree-shake more effectively.
Switch ESM build configs from module "ESNext" + moduleResolution "bundler" to module "NodeNext" + moduleResolution "NodeNext" to ensure relative imports require .js extensions (required by Node's ESM loader). Add "type": "module" to all packages, fix ~240 extensionless relative imports, fix graphql-tag default import to named import, and add JSON import attributes where needed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
To use Codex here, create a Codex account and connect to github. |
|
Codex Review: Didn't find any major issues. 🎉 ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
Summary
lib/cjs/) and ESM (lib/esm/) builds via separatetsconfig.build.cjs.jsonandtsconfig.build.esm.jsonconfigspublishConfiguses conditionalexportswithtypes/import/requireconditionspackage.jsonfiles ({"type":"commonjs"}/{"type":"module"}) are generated in each output dir for proper Node.js resolutiontypesVersionsto@morpho-org/testfor subpath export resolution undernode10module resolutionTest plan
pnpm -r buildpasses for all 13 packages"use strict"; var __createBinding = ...)export * from ...)package.jsonfiles generated correctlypnpm -r testpassesFixes SDK-91
🤖 Generated with Claude Code