Best practices for managing and deploying large JavaScript apps

后端 未结 7 1781
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-04 14:38

What are some standard practices for managing a medium-large JavaScript application? My concerns are both speed for browser download and ease and maintainability of developm

相关标签:
7条回答
  • 2020-12-04 15:32

    In our big javascript applications, we write all our code in small separate files - one file per 'class' or functional group, using a kind-of-like-Java namespacing/directory structure. We then have:

    • A compile-time step that takes all our code and minifies it (using a variant of JSMin) to reduce download size
    • A compile-time step that takes the classes that are always or almost always needed and concatenates them into a large bundle to reduce round trips to the server
    • A 'classloader' that loads the remaining classes at runtime on demand.
    0 讨论(0)
提交回复
热议问题