'Understanding module approach in typescript switching from js++
I have a front-end script written in JS++. I have about 10 modules. These modules include classes, functions, etc. I will call them objects. Some pages in my web project use some objects, other pages use other objects. I have a main file for a certain page (script). JS++ analyzes this file and builds a separate JS file with objects that I use. Other functions or classes are just missing in the output file. Thus, modules exist only in CT. Modules exist only for developers. My friend told me JS++ is not a popular language and I should try Typescript, for example. So, I've tried, and I can't understand a few things.
- The module system is without a doubt the most comfortable mode of transportation. But 10 modules are 10 requests to a server. Not everyone knows that the biggest part of loading a script is g etting a response from the server. And the approach can take a whole lot of wasted time to load the required files. In comparison to single-file
- Even if you compile your end script to a single file (for example, like in the explanation here), unused functions in the entire module will still exist.
I understand the module approach in JS++. Can you explain my approach in typescript? I doubt I am the first person to wonder about this.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|