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

Size is too large ( it that possiable to have less then 1MB package size ) #13

Closed
hanoj-budime opened this issue Jan 17, 2022 · 8 comments

Comments

@hanoj-budime
Copy link

image

@jdesrosiers
Copy link
Collaborator

This packages is actually very small and I take great care to make sure that it stays that way. See https://bundlephobia.com/package/@hyperjump/json-schema@0.18.3 for a more accurate assessment than what you see on npmjs.com. The current version is about 150KB raw, 79KB minified, and 13KB compressed.

The reason it appears to be so big is because I package several pre-built bundles in different formats for people who aren't using bundlers can include the package using unpkg: https://unpkg.com/browse/@hyperjump/json-schema@0.18.3/dist/. These builds will not be included when this code gets bundled into your app.

@hanoj-budime
Copy link
Author

Hi @jdesrosiers,

Thanks for your response.

But we are using this package in our Node.js Project ( package version is @hyperjump/json-schema@0.11.1 ).

After deployment, this project in AWS lambda shows project size is more then 3.2 MB.

Because of this https://bundlephobia.com/package/@hyperjump/json-schema@0.11.1

Can please help me on this.

@jdesrosiers
Copy link
Collaborator

Ah, now it makes sense. It would be that large on disk. I never thought of that as an issue, but I assume AWS lambda has limits on how big a lambda can be.

I'm not sure what can be done about that other than removing the pre-built bundles, but I'm not sure I want to do that. I might be able to do something with a postinstall script that deletes the "dist" directory, but I don't know if that would work. I'll look into it and see if there's anything I can do.

@jdesrosiers jdesrosiers reopened this Jan 20, 2022
@jdesrosiers
Copy link
Collaborator

I added a postinstall script to remove the dist directory and it seems to work. The pre-bundled distributions are still available on unpkg and the final size in node_modules including dependencies is under 600KB. The npm install command will still download the whole thing, but will delete the files that aren't needed for a node application. I don't know if that ends up helping in you situation or not. It depends on how AWS lambda counts size.

Give it a try with version 0.18.4 and let me know if it works.

@hanoj-budime
Copy link
Author

hanoj-budime commented Feb 15, 2022

Thanks, @jdesrosiers.

Now I can see the Package size reduce.

But this works on pipeline & Linux, not in Windows right?

@hanoj-budime
Copy link
Author

I added a postinstall script to remove the dist directory and it seems to work. The pre-bundled distributions are still available on unpkg and the final size in node_modules including dependencies is under 600KB. The npm install command will still download the whole thing, but will delete the files that aren't needed for a node application. I don't know if that ends up helping in you situation or not. It depends on how AWS lambda counts size.

Give it a try with version 0.18.4 and let me know if it works.

Worked

@hanoj-budime
Copy link
Author

Worked For Me ( in Linux, But not in Windows ).

Maybe it's fine if you just provide steps to write a post-install script in their owner project. instead of doing here.

@jdesrosiers
Copy link
Collaborator

Thanks for checking. I always forget windows exists. I'm pretty sure I know what I have to do to make it work everywhere.

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

2 participants