Does it matter to import server-side npm modules in a modular way?

I’m wondering if it actually has any performance differences importing npm modules globally in a file (say a file containing methods for example using the imported variables) or if there is an upside to only import modules as needed. If there’s a performance benefit, how would you actually do that?