Since the birth of Javascript, no one has ever regarded it as a programming language. In the Web 1.0 era, this scripting language was mainly used for form validation and web page special effects. It wasn't until the Web 2.0 era, when front-end engineers used it to greatly improve the user experience on web pages, that JS was widely valued. As JS becomes more and more popular, it has roughly gone through changes in tool libraries, component libraries, front-end frameworks, and front-end applications. Javascript inherently lacks one feature: modules, and the emergence of the CommonJS specification makes up for this shortcoming. This article will introduce the CommonJS specification and Node’s module mechanism.
Among other high-level languages, Java has class files, Python has an import mechanism, and PHP has include and require. The way JS introduces code through the