Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework variants to reduce bundle size #139

Merged
merged 32 commits into from
Feb 28, 2024
Merged

Rework variants to reduce bundle size #139

merged 32 commits into from
Feb 28, 2024

Conversation

MattiasBuelens
Copy link
Owner

@MattiasBuelens MattiasBuelens commented Jan 4, 2024

This removes some variants and build artifacts to reduce the total download size of the npm package.

  • Remove all generated source maps.
  • Remove the ES2018 variant, which is now combined into the ES6 variant. This means that ReadableStream.prototype[Symbol.asyncIterator] won't correctly inherit from %AsyncIteratorPrototype%, but nobody cares about that. 😛
  • Remove unminified polyfill variants. All build artifacts for the polyfill variants are now always minified, while the ponyfill variants are always unminified.
  • Switch to subpath exports for the different variants.
  • Remove down-leveling for TypeScript 3.5 or lower. We need at least TypeScript 4.7 for it to support the package entry points anyway.

Ported from #83 and #107.

@MattiasBuelens
Copy link
Owner Author

Package size with this PR:

$ npm pack
npm notice 
npm notice package: [email protected]
npm notice === Tarball Contents ===
npm notice 1.1kB  LICENSE
npm notice 6.4kB  README.md
npm notice 70.6kB dist/polyfill.es5.js
npm notice 64.7kB dist/polyfill.js
npm notice 70.7kB dist/ponyfill.es5.js
npm notice 70.5kB dist/ponyfill.es5.mjs
npm notice 64.8kB dist/ponyfill.js
npm notice 64.2kB dist/ponyfill.mjs
npm notice 3.2kB  package.json
npm notice 1.2kB  types/polyfill.d.ts
npm notice 33.8kB types/ponyfill.d.ts
npm notice 329B   types/tsdoc-metadata.json
npm notice === Tarball Details ===
npm notice name:          web-streams-polyfill
npm notice version:       3.3.2                                   
npm notice filename:      web-streams-polyfill-3.3.2.tgz
npm notice package size:  98.4 kB
npm notice unpacked size: 451.5 kB
npm notice shasum:        4665d4e93355835fbc6f191280b0e118bc0b86a2
npm notice integrity:     sha512-qlYtN3YEOFidz[...]59brCzcbDKVyw==
npm notice total files:   12
npm notice

@MattiasBuelens MattiasBuelens merged commit 0616eb6 into v4 Feb 28, 2024
5 checks passed
@MattiasBuelens MattiasBuelens deleted the reduce-bundle-size branch February 28, 2024 21:04
mikaello added a commit to mikaello/emit-punch-cards-communication that referenced this pull request Jul 17, 2024
mikaello added a commit to mikaello/emit-punch-cards-communication that referenced this pull request Jul 17, 2024
mikaello added a commit to mikaello/emit-punch-cards-communication that referenced this pull request Jul 17, 2024
* chore(deps): update dependency web-streams-polyfill to v4

* test: web-stream-polyfill es2018 → es2015

See MattiasBuelens/web-streams-polyfill#139

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: mikaello <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant