hosseinmd / prettier-plugin-jsdoc

A Prettier plugin to format JSDoc comments.
MIT License
232 stars 28 forks source link

Reduce package size #165

Closed TrySound closed 2 years ago

TrySound commented 2 years ago

Just found the size of this package is quite huge, ~17MB. https://packagephobia.com/result?p=prettier-plugin-jsdoc

This is because all prettier parsers are bundled with plugin sources. This is because external array skips exact matches. Though imports like prettier/parser-typescript are included which resulted in huge bundle size.

With this chagen we see great size reduction

   1886 index.d.ts
  45690 index.js
  19076 index.min.mjs
  50735 index.umd.js
  18920 index.umd.min.js

Build time is down from 168s to 7s

cc @hosseinmd

TrySound commented 2 years ago

There is also a way to reduce install size by bundling all dependencies except prettier and its parsers.

  287092 index.js
  108650 index.min.mjs
  306744 index.umd.js
  108516 index.umd.min.js
hosseinmd commented 2 years ago

Hi dear Thank you Your Code wasn't correct, but I made a mistake and merged this pull request.

hosseinmd commented 2 years ago

Look this issue: https://github.com/hosseinmd/prettier-plugin-jsdoc/issues/150 There is an ESM module, we need to add it to bundle.