JavaScript Modules – Single Compressed JS File vs Compressed RequireJS Module Files

javascriptmodules

I just started using requirejs and I love it. I have one concern though. I've been compressing all my js files into one single file. Even with requirejs optimizer, I need to load module files from the server time to time and I'm concerned with it.

Performance and user experience wise, which one is better?

Best Answer

Performance and user experience wise, which one is better?

A single compressed file.

It is a single connection, so the browser is free to download other assets.

It is compressed, so it takes less time to transfer to the browser.

Both mean that the page and the javascript run faster - this is better user experience and better performance.

Win win.

Related Topic