scalar / openapi-parser

Modern OpenAPI parser written in TypeScript
MIT License
34 stars 1 forks source link

chore: switch to rollup #103

Closed hanspagel closed 2 months ago

hanspagel commented 2 months ago

Tree shaking doesn’t really work and it must be something with the build. I couldn’t find a solution with Vite, but tree shaking seems to work just fine with Rollup.

With this PR the library will be built with Rollup instead of Vite. According to my tests, this fixes the problem. My test:

There’s a tiny Vue app in demo/. I removed the alias and tried to import validate vs. not importing validate (because it needs the huge ajv library). And in that case the bundle size switched between 211 kb und 350 kb.

Let’s release it and test it in scalar/scalar next!

changeset-bot[bot] commented 2 months ago

🦋 Changeset detected

Latest commit: aa23557ff65b9aa21f6fe9d6228d07e6d4b98433

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---------------------- | ----- | | @scalar/openapi-parser | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

relativeci[bot] commented 2 months ago

#64 Bundle Size — 114.09KiB (-0.75%).

aa23557(current) vs 4351d85 main#63(baseline)

Bundle metrics  Change 5 changes Improvement 2 improvements
                 Current
#64
     Baseline
#63
Improvement  Initial JS 114.09KiB(-0.75%) 114.96KiB
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
Change  Chunks 44(+4300%) 1
Change  Assets 44(+4300%) 1
Change  Modules 44(-6.38%) 47
No change  Duplicate Modules 0 0
No change  Duplicate Code 0% 0%
Improvement  Packages 0(-100%) 2
No change  Duplicate Packages 0 0

Bundle size by type  Change 1 change Improvement 1 improvement
|            |       Current
[#64](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/64-70pDljcZA8uLXi4g54PQ?utm_source=github&utm_medium=pr-report "View bundle analysis report") |      Baseline
[#63](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/63-3i9jB65EnbuMd8eWJRbv?utm_source=github&utm_medium=pr-report "View baseline bundle analysis report") | |:--|--:|--:| | Improvement  [JS](https://app.relative-ci.com/projects/hXQ54UQKluDUZAKvpt9b/jobs/64-70pDljcZA8uLXi4g54PQ/assets?ba=%7B%22filters%22%3A%22ft.CSS-0_ft.JS-1_ft.IMG-0_ft.MEDIA-0_ft.FONT-0_ft.HTML-0_ft.OTHER-0%22%7D "View JS assets") | `114.09KiB` (`-0.75%`) | `114.96KiB` |

Bundle analysis reportBranch chore/rollupProject dashboard