feat(packaging): ship CommonJS builds alongside ESM for v2 packages (#2405)

This commit is contained in:
Matt 2026-07-01 17:40:37 +01:00 • committed by GitHub
commit f172626a8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 293 additions and 117 deletions

View file

@ -23,10 +23,17 @@
],
"exports": {
".": {
"types": "./dist/index.d.mts",
"import": "./dist/index.mjs"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}
},
"main": "./dist/index.cjs",
"types": "./dist/index.d.mts",
"files": [
"dist"

View file

@ -3,7 +3,8 @@ import { defineConfig } from 'tsdown';
export default defineConfig({
failOnWarn: 'ci-only',
entry: ['src/index.ts'],
format: ['esm'],
format: ['esm', 'cjs'],
fixedExtension: true,
outDir: 'dist',
clean: true,
sourcemap: true,