The public directory in a Next.js application is used to serve static assets like images, fonts, and other files. These files are not included in the JavaScript bundle, so they don't directly contribute to the JavaScript payload size. They are served separately by the server or CDN.
However, if you have a large number of static assets in the public directory, it could potentially increase the amount of data that needs to be downloaded by the client. This is especially true if these assets are large in size.
To optimize the delivery of these static assets, you can leverage the caching capabilities of CDN providers. Files inside the public directory can be cached by CDN providers so that they are delivered efficiently.
Also, Next.js does not safely cache assets in the public folder because they may change. The default caching headers applied are Cache-Control: public, max-age=0.
If you're dealing with a large number of SVG files and are concerned about the payload size, you might want to consider using a third-party service like Vercel Blob or AWS S3 for persistent file storage. Only assets that are in the public directory at build time will be served by Next.js. Files added at request time won't be available [source (https://nextjs.org/docs/pages/building-your-application/optimizing/static-assets)].
In terms of SVGs specifically, if you're using them as React components (option 2), they will be included in your JavaScript bundle and will contribute to its size. However, this allows you to manipulate them as JSX elements and could potentially save on HTTP requests since they are included in the initial payload.