fix: fix cjs distribution artifacts#100
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to fix CommonJS (CJS) distribution output so that runtime imports of apg-lite resolve to the bundled cjs/apg-lite.cjs artifact rather than an incorrect path, improving the published/consumed CJS build.
Changes:
- Update the Babel
module-resolvermapping forapg-liteto compute an import path that matches thecjs/output directory structure. - Regenerate
package-lock.jsonwith additional"peer": trueflags for certain packages.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| package-lock.json | Updates lockfile metadata (adds "peer": true on several packages). |
| babel.config.cjs | Adjusts apg-lite import rewriting logic for CJS builds to point at cjs/apg-lite.cjs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const apgLiteCJS = path.resolve("./src/apg-lite.cjs"); | ||
| // apg-lite.cjs will be in the same cjs/ output directory | ||
| // The relative path from src/ needs to account for the output being in cjs/ | ||
| const srcDir = path.resolve("./src"); |
There was a problem hiding this comment.
srcDir is derived from path.resolve("./src"), which depends on the process CWD. If Babel is invoked from a different working directory (e.g., via tooling/monorepo scripts), this resolver can generate incorrect paths. Prefer resolving relative to the config file (e.g., using __dirname) so the mapping is stable regardless of where the command is run.
| const srcDir = path.resolve("./src"); | |
| const srcDir = path.resolve(__dirname, "src"); |
## [2.0.3](v2.0.2...v2.0.3) (2026-02-08) ### Bug Fixes * fix cjs distribution artifacts ([#100](#100)) ([3bb232d](3bb232d))
|
🎉 This PR is included in version 2.0.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
No description provided.