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

Reduce Lambda Package size #10

Closed
DregondRahl opened this issue Apr 24, 2021 · 2 comments
Closed

Reduce Lambda Package size #10

DregondRahl opened this issue Apr 24, 2021 · 2 comments

Comments

@DregondRahl
Copy link

DregondRahl commented Apr 24, 2021

After running prisma generate inside afterBundling(), we won't need the prisma package anymore. we could run yarn remove after that, also we won't need the prisma-appsync package if its being compiled. Removing them reduces the size significantly.

Zipped file size reduced from 75MB to 19MB

              // added some other clean up also.
              "yarn prisma generate",
              "rm -rf node_modules/.prisma/client/query-engine-debian-openssl-1.1.x",
              "rm -rf node_modules/@prisma/engines-version/*",
              "rm -rf node_modules/@prisma/engines/*",
              "yarn remove prisma",
              "yarn remove prisma-appsync",

Is there any reason to keep the packages?

@maoosi
Copy link
Owner

maoosi commented Apr 24, 2021

No particular reason. In fact, I recently ran into an issue with bundle sizing myself and made some changes to the provided CDK template (https://github.com/maoosi/prisma-appsync/blob/next/boilerplate/cdk/index.ts#L110). I'll merge with the main branch soon.

After asking the question to Ryan Dsouza from the Prisma team, he told me we could safely do the following:

afterBundling(inputDir: string, outputDir: string): string[] {
    return [
        'npx prisma generate', 
        'rm -rf node_modules/@prisma/engines', 
        'rm -rf node_modules/@prisma/client/node_modules', 
        'rm -rf node_modules/.bin', 
        'rm -rf node_modules/prisma'
    ]
}

I should probably add prisma-appsync to the list as well!

@maoosi maoosi closed this as completed Apr 25, 2021
@maoosi
Copy link
Owner

maoosi commented Apr 25, 2021

Resolved with 1.0.0-beta.52

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