const oneConfig = { ...someParams }
const oneFunction = function (){ return oneConfig }
1. export oneConfig;
2. export oneFunction;
If I have an object that needs to be exported, then there seem to be two ways. What is the difference? What is the difference between memory usage, performance, and js engine processing?
If I just import the file but don't execute it immediately
As the comments (by Jaromanda X and Gabriele Petrioli) point out, the function essentially adds a layer of indirection around the object. Exporting the object directly is slightly more efficient in terms of performance, because then the importer doesn't have to call the function; it is slightly more memory efficient if you don't need the function for anything else and can simply drop it.
That said, the differences are too small to matter; you should do whichever makes more sense for your application. If wrapping things in a function is more convenient, or more consistent, or otherwise preferable, then do that and don't worry about performance; on the other hand if you don't need the function (and it's simpler without), why add something you don't need?