I'm researching on Serverless applications using AWS Lambda and NodeJS.
I was looking into using Webpack to bundle all my NodeJS backend code into a single JavaScript file, and to use features like tree shaking.
For the way I understand Node works, imports (or requires) are resolved in runtime.
I'm afraid that bundling everything in a single file will affect my app's performance by always loading the entire JS file, instead of only loading the JS files as they are resolved during the code's execution. For a small application, the impact my be small, but as my app grows, the bundle will too.
I could create multiple bundles, one for each of my Lambda functions, but my question is: Is my concern valid?
In a mere NodeJS context, will bundling everything in a single file affect my performance, even by a small amount?
Note: AWS Lambda does support ES5 so using Webpack just to transpile is not a factor in here.