How to Create a Visual JavaScript Editor Yourself
In a normal state, when running “A.js”, 42 will pop up in the console.
We create a string, it will be sent to the Function constructor:
How to Create a Visual JavaScript Editor Yourself
You'll notice that the transpiledFiles array is used, which contains strings. and will be used later. We move the code to the closure and avoid conflicts with other files in the future. In addition, we will determine where require comes from and where exports goes.
We also have an empty object, it will store all the information that the file exports. In the case of B.js, this is the number 42.
Next, we implement the require function and execute the file saudi arabia email list code according to index:
How to Create a Visual JavaScript Editor Yourself
The modules array is a package that contains all the code data. The require function scans this package, finds the required files in it, and starts closing it.
Let's look closely at the transfer of the same functions require and the module exports object. This object makes a return at the end.
The last fragment closes this file. The generated code looks like this:
How to Create a Visual JavaScript Editor Yourself