You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
package-layout convention: never bundle, ship dist/ as one file per module #582
priority: highNeeds attention soon — not blocking, but don't let it sitstatus: implementedBuilt and deployed, but not yet fully tested/verifiedtype: documentationRelates to docs, README updates, guides, or inline code comments
docs/conventions/package-layout.md tells libraries to bundle src/ with tsup into dist/index.mjs (plus bin/<name>.mjs for a CLI), modeled on vitest-runner. Bundling duplicates code whenever a package has more than one entry:
lib-sqlite-wasm: it has four entries that share classes. Separate bundles gave each entry its own copy of the error class, which broke instanceof, so the build turned on splitting, and 0.1.0/0.2.0 ship hashed chunk-*.mjs files.
The build shouldn't move code around or merge it into one file. Minify (and obfuscate, where a repo wants that) each file in place, but never duplicate code to fit a bundler. The convention should say:
dist/ (and bin/) mirror src/, one file per module, minified in place with keepNames.
No bundling, no splitting, no chunk-* files, and no code duplicated across entries or between dist/ and bin/. A CLI imports the library from dist/.
The hand-written index.cjsrequire(esm) shim stays as it is.
Reference implementation: CLDMV/lib-sqlite-wasm scripts/build-js.mjs (on its fix/unbundled-dist branch until merged). tsc emits dist/ with rewriteRelativeImportExtensions, then esbuild minifies each file in place with source maps chained back to src/. Plain-.mjs repos can run esbuild with bundle: false directly.
Once this lands, the repos still on the tsup bundle need migrating. I'll inventory them and file one issue each.
priority: highNeeds attention soon — not blocking, but don't let it sitstatus: implementedBuilt and deployed, but not yet fully tested/verifiedtype: documentationRelates to docs, README updates, guides, or inline code comments
Activity
docs(package-layout): ship dist/ as one file per module, never a bundle
docs(package-layout): ship dist/ as one file per module and use one g…
cldmv-bot commentedon Nov 26, 2026
Marked
status: implemented— resolved by #584, merged intonext. This issue closes automatically when that work ships to the default branch.release: v4.46.0 - add extra_build_os for a build check on other…