The payments-next builds are taking very long and using many system resources.
Under normal operation, the payments-next service in dev mode is using a lot of memory and at times running into its 7gb memory limit, causing a service restart.
This pull request
Adds Next.js bundle analyzer to payments-next
Adds additional packages to serverComponentsExternalPackages.
By default Nextjs automatically bundles dependencies used in Server Components and Route Handlers. As a result, all dependencies used in the NestApp were being bundled by Next.js, which bloated the Next.js nodejs bundle.
All dependencies used in the NestApp, should not be included in the Next.js bundle, and should therefore be added to serverComponentsExternalPackages going forward.
Dependencies that are potentially used by Next.js as part of server side rendering or hydration of pages should still be included in the Next.js bundle, and should not be added to serverComponentsExternalPackages.
Issue that this pull request solves
Closes: #FXA-10712
Checklist
Put an x in the boxes that apply
[x] My commit is GPG signed.
[x] If applicable, I have modified or added tests which pass locally.
[x] I have added necessary documentation (if appropriate).
[x] I have verified that my changes render correctly in RTL (if appropriate).
Screenshots (Optional)
Memory usage
Before changes
After changes
Other information (Optional)
The bundler analyzer can be run with the following command
ANALYZE=true nx build payments-next
Before and after version of the output from the bundle analyzer for the nodejs and client bundles can be found at the Google Drive linked below.
Because
payments-next
builds are taking very long and using many system resources.payments-next
service in dev mode is using a lot of memory and at times running into its 7gb memory limit, causing a service restart.This pull request
payments-next
serverComponentsExternalPackages
going forward.serverComponentsExternalPackages
.Issue that this pull request solves
Closes: #FXA-10712
Checklist
Put an
x
in the boxes that applyScreenshots (Optional)
Memory usage
Before changes
After changes
Other information (Optional)
The bundler analyzer can be run with the following command
Before and after version of the output from the bundle analyzer for the nodejs and client bundles can be found at the Google Drive linked below.