xregexp
xregexp copied to clipboard
Expected volume reduction
After analyzing it with bundle analyze, it is found that the library is referenced and there are more than 600 kb without compression. It's too big. Can it be made into something like lodash-es, partially introduced and partially realized! Thank you
Happy to hear your ideas about what specifically would be changed and how this would be achieved. And I'd be happy to consider PRs.
Note that XRegExp is already split into a much smaller base script and a collection of addons. It's just that all the addons are bundled together with the base script for the npm package. Some of the Unicode addons are where almost all of the size comes from.
as your say
Use the following files in es mode
https://github.com/slevithan/xregexp/blob/2dcf16d0aef8b985767886e0d392ce735fd7bff9/package.json#L20
But add all addons to base script https://github.com/slevithan/xregexp/blob/2dcf16d0aef8b985767886e0d392ce735fd7bff9/src/index.js#L10-L15
So it's impossible to tree shake.
Therefore, it should be used base script
import XRegExp from 'xregexp/src/xregexp'
Due to the use of TS
in the project.
Will report an error and cannot find the declaration file for the module "xregexp/src/xregexp".
Whether addons and base scripts should be exported?
Do you have some updated here?