Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected volume reduction #338

Open
linqunhe opened this issue Oct 14, 2021 · 3 comments
Open

Expected volume reduction #338

linqunhe opened this issue Oct 14, 2021 · 3 comments

Comments

@linqunhe
Copy link

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

@slevithan
Copy link
Owner

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.

@SCWR
Copy link

SCWR commented Feb 7, 2022

as your say

Use the following files in es mode

"module": "./src/index.js",

But add all addons to base script

xregexp/src/index.js

Lines 10 to 15 in 2dcf16d

build(XRegExp);
matchRecursive(XRegExp);
unicodeBase(XRegExp);
unicodeCategories(XRegExp);
unicodeProperties(XRegExp);
unicodeScripts(XRegExp);

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?

@janhoeck
Copy link

Do you have some updated here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants