chevrotain icon indicating copy to clipboard operation
chevrotain copied to clipboard

Smaller web bundle size

Open bd82 opened this issue 2 years ago • 1 comments

The chevrotain.min,js and chevrotain.min.mjs are currently 156/160kb respectively. (version 9.1.0). This will likely slightly increase in v10 due to the introduction of lodash as a dependency.

Some avenues which may help decrease the bundle size:

  • [ ] Find a way to avoid duplicate TypeScript helpers. - e.g: search for: var __extends = (this && this.__extends) in chevrotain.js (none minified).
  • [ ] Would ` target : "es2015" in the tsconfig reduce the bundle size, by reducing transpilation to lower level EcmaScript?
  • [ ] Provide a specialized bundle which only includes the mandatory runtime components, e.g: - No diagrams related sources - No @chevrotain/cst-gen (not yet used by the main chevrotain package, but will be in the future). - Empty implementations for most (all?) of the grammar / lexer validations and checks.

bd82 avatar Nov 02 '21 00:11 bd82

https://stackoverflow.com/questions/20128257/typescript-removing-extends-duplicates

bd82 avatar Nov 02 '21 00:11 bd82

206K --> 136K (chevrotain.min.js) is good enough for now. Closing this issue.

bd82 avatar Jul 08 '23 19:07 bd82