3 ms·
The main reason you pack scripts is because you're compiling, and your compiler is checking and optimizing your cross-file interactions. For example, you need t
by jimrandomh 8y ago
The main reason you pack scripts is because you're compiling, and your compiler is checking and optimizing your cross-file interactions. For example, you need to merge scripts to be able to detect and delete unused functions, because otherwise some unmerged script might call the function without the compiler being able to detect it.
- setr 8y agoIt seems like it would be trivial for your compiler to go ahead and split the files up again afterwards. Its not like you cared about file organization on the client side anyways if you were packing them, so its free to split however it feels. And ofc you’d naturally just attribute this as an artifact of optimization, just as single-file packing was. Which it is, given http 2/3
- kartickv 8y agoNo, because if you split it into two pieces, common utility functions will be called from both pieces, at which point you have to duplicate them. Splitting probably makes sense only for an infrequently used feature, like video chat in an app like Gmail or Slack.