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

What caused the size increase? #219

Closed
StephenTangCook opened this issue Feb 28, 2020 · 3 comments
Closed

What caused the size increase? #219

StephenTangCook opened this issue Feb 28, 2020 · 3 comments
Labels

Comments

@StephenTangCook
Copy link

We haven't updated our npm dependency since v3.0.0 and now at v6.1.0 there is a nontrivial size increase. npm.js reports the unpacked size of 3.2.0 to be 30.9kB and 4.0.0 to be 470kB.
Curious what caused the jump?

@jonchurch
Copy link
Member

jonchurch commented Feb 28, 2020

It looks to be the way things are compiled w/ Typescript now?

Running npm pack --dry-run on v6.1.0 shows the tarball unpacked as 476.3 kB.

v.s. on v3.2.0 it's 30.9kb

Here's a gist w/ the output for each version's npm pack --dry-run:
https://gist.github.com/jonchurch/c22c4f87f25377d800967772a55ba4db

I don't honestly know much about typescript, but it appears that the file src/index.spec.ts is also included in the build. I assume that is a testing only file, and if that's the case, then it should not be bundled.

Ignoring that file cuts the bundled size down to 109.8 kB unzipped and produces the following npm pack --dry-run output:

npm notice 📦  [email protected]
npm notice === Tarball Contents ===
npm notice 1.1kB  LICENSE
npm notice 14.1kB dist.es2015/index.js
npm notice 14.4kB dist/index.js
npm notice 2.0kB  package.json
npm notice 28.7kB dist.es2015/index.js.map
npm notice 28.8kB dist/index.js.map
npm notice 4.9kB  History.md
npm notice 11.5kB Readme.md
npm notice 4.3kB  dist/index.d.ts
npm notice === Tarball Details ===
npm notice name:          path-to-regexp
npm notice version:       6.1.0
npm notice filename:      path-to-regexp-6.1.0.tgz
npm notice package size:  17.6 kB
npm notice unpacked size: 109.8 kB
npm notice shasum:        c94f8e667f366acd28fe9b1d3e44544d72da98b3
npm notice integrity:     sha512-Ox4oTsd6G18lv[...]P3cqOWRxA3WRw==
npm notice total files:   9

@blakeembrey
Copy link
Member

The NPM pack size will always be a bit misleading here since it counts everything. For example, we publish both ES2015 and CommonJS which also doubles the size. However, the package has grown in size each version it's doing a bit more each time by exposing simpler ways to use the package (e.g. pathToRegexp -> match).

@jonchurch
Copy link
Member

Closing as answered, and the pack size has been reduced w/ #220

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants