Add TypeScript/ESM build pipeline while keeping legacy bundle intact #87
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.
Summary
src-ts/and emit ESM, CJS, and.d.tsoutputstsconfigfiles for the modern builds plus a lightweight terser-based UMD bundledist/accordion.min.jsso existing consumers remain unaffectedMotivation
typesgive Node/TypeScript users first-class support without external wrappers<script>/ CDN users because the legacy UMD bundle and Gulp workflow stay intactBuild Outputs
esm/cjs/dist-types/dist/accordion.min.jspackage.jsonexposes the builds like this:{ "main": "dist/accordion.min.js", "module": "esm/index.js", "types": "dist-types/index.d.ts", "exports": { ".": { "types": "./dist-types/index.d.ts", "import": "./esm/index.js", "require": "./cjs/index.js", "default": "./dist/accordion.min.js" }, "./dist/accordion.min.css": "./dist/accordion.min.css" } }Testing / Verification
npm run buildnpm run build:legacynpm run build:bundlenode -e "import('./esm/index.js').then(m => console.log(Object.keys(m)))"node -e "console.log(Object.keys(require('./cjs/index.js')))"Size (legacy UMD, minified)
Docs
Backward Compatibility
exportsNotes / Follow-ups
npm run build,npm run build:legacy, and a minimal import smoke test for both module formats