I was just going through the /admin/server/api/cloudinary.js file and noticed it's importing the cloudinary node library at the function level -- in three separate functions.
Is there a specific reason it's doing this as against importing it at the package/module level ? Seeing the require action is synchronous.
see -
From memory, we went through a whole effort to reduce the initial boot time by only requiring packages you were actually using (when they were first used).
require is sync but cached, so you only pay the cost of this once the first time the API route is hit. It's a trade-off with doing the require when Keystone is first required, which would include users that aren't even using coudinary.
Most helpful comment
From memory, we went through a whole effort to reduce the initial boot time by only requiring packages you were actually using (when they were first used).
requireis sync but cached, so you only pay the cost of this once the first time the API route is hit. It's a trade-off with doing the require when Keystone is first required, which would include users that aren't even using coudinary.