jxson / front-matter

Extract YAML front matter from strings
MIT License
675 stars 76 forks source link

Very large size in browser bundle #79

Open alex996 opened 3 years ago

alex996 commented 3 years ago

When bundled for browsers, this modules adds over 170 KB in bundle size via js-yaml (38 KB) and its dependency esprima (130 KB). You can verify the estimated size on bundlephobia.

I noticed that this isn't limited to front-matter. Other packages like gray-matter and yaml-front-matter are in the same 170+ KB ballpark size. However, it's worth mentioning this in the readme (looks like it's one of the todos in #37) because the added size makes this package unsuitable for browsers.

Using a different/custom parser may solve this issue.

szilarddoro commented 3 years ago

+1

front-matter and gray-matter are using js-yaml@3.13.1 which listed esprima as a dependency, but the latest version of js-yaml is not listing it as a dependency anymore.

Probably front-matter to use the latest version of js-yaml would solve this browser bundle size issue.