Repository navigation
build!: drop the CommonJS build - #1366
Merged
Merged
Conversation
The package ships only its ES module build, with an exports map and no main or module fields, as tree-shakeable packages of the Trigen baseline do. The default condition lets Node.js 20.19+ and 22.12+ require() it. The build clears dist first, so an old index.cjs cannot be published. BREAKING CHANGE: react-chartjs-2 is ESM only. Bundlers and Node.js 20.19+ or 22.12+ load it as before; older Node.js needs ESM code, and Jest needs to transform the package or run with ES modules support. See https://react-chartjs-2.js.org/docs/migration-to-v6/
The guide and the FAQ answer to "Cannot find module" explain how to load the ESM-only package in Node.js, Jest and TypeScript.
This was referenced Nov 30, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1366 +/- ##
=======================================
Coverage 93.97% 93.97%
=======================================
Files 3 3
Lines 83 83
Branches 20 20
=======================================
Hits 78 78
Misses 3 3
Partials 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
dangreen
marked this pull request as ready for review
November 30, 2026 16:03
Merged
dangreen
added a commit
that referenced
this pull request
Nov 30, 2026
The package ships only its ES module build, with an exports map and no main or module fields, as tree-shakeable packages of the Trigen baseline do. The default condition lets Node.js 20.19+ and 22.12+ require() it. The build clears dist first, so an old index.cjs cannot be published. The migration guide to v6 and the FAQ answer to "Cannot find module" explain how to load the ESM-only package in Node.js, Jest and TypeScript. BREAKING CHANGE: react-chartjs-2 is ESM only. Bundlers and Node.js 20.19+ or 22.12+ load it as before; older Node.js needs ESM code, and Jest needs to transform the package or run with ES modules support. See https://react-chartjs-2.js.org/docs/migration-to-v6/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 8 of the tooling stack. Based on master (#1354–#1360 are merged). Breaking: releases as v6.0.0.
Replaces #1362: the CommonJS drop now goes before the Starlight website, so the docs here are for the current Docusaurus website and the Starlight PR moves them over.
What
ESM only. Vite builds only
dist/index.js;dist/index.cjsis gone.Exports map only in the published
package.json, as thetree-shakingskill andnano_kitdo: nomain, nomodule.The condition is
default, notimport, so Node.js 20.19+ and 22.12+ can stillrequire()the package (require of ESM). The top-leveltypesstays for TypeScript'snode10resolution.buildclearsdistfirst (as innano_kit), so a staleindex.cjson a maintainer's machine cannot end up in the tarball.Docs:
AGENTS.mdstates the new policy.The commit is
build!:with aBREAKING CHANGEfooter, so simple-release bumps the major version; keep the!in the title when squash-merging.Unchanged
API, props, types,
peerDependencies,sideEffects: false, sizes (973 B for everything, 582 B forChart, 99 B for an event helper).Checked locally
pnpm test,pnpm test:size,pnpm prepublishOnly:package/distcontains onlyindex.jsand declarations.require('react-chartjs-2')andimport('react-chartjs-2')both give the 12 exports;moduleResolutionbundler,nodenext,node10, andnode16in an ESM project.node16in a CommonJS project reports TS1479, as the guide says; Chart.js types give the same error there;import { getElementAtEvent }into 212 B.pnpm buildinwebsite):/docs/migration-to-v6/is generated and linked in the docs sidebar, and the FAQ answer is updated.Stack
🤖 Generated with Claude Code