When you start working with WebPack for GameTime, you'll notice that you can't just define a variable in one file and find it in another as easily as you can in Rails.
Read Node.js, Require and Exports and Organize Your Code with RequireJS
-
In the context of Node, what is a
module
?
Amodule
is a "building block" that is made from an individual.js
file. -
The code examples from the second blog post look very different from the first. Why?
In the first post, node is converting all of the files into modules, while in the second post, we are explicitly defining modules within files. They are two different ways of accessing functions and variables in other files.
👍