xregexp icon indicating copy to clipboard operation
xregexp copied to clipboard

Expected volume reduction

Open linqunhe opened this issue 3 years ago • 3 comments

image

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

linqunhe avatar Oct 14 '21 03:10 linqunhe

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.

slevithan avatar Oct 14 '21 07:10 slevithan

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?

SCWR avatar Feb 07 '22 08:02 SCWR

Do you have some updated here?

janhoeck avatar Nov 10 '22 15:11 janhoeck