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
? -
A Module is a the fundamental Node building block which maps directly to a file. Almost like Ruby in which you can take a class or method and import/export it to another file allowing you to use the previous files functions in the new one.
-
The code examples from the second blog post look very different from the first. Why?
-
The second post is using require.js which is a library making life easier to use, in order to associate things inside the module with variables in another file. The first post seemed to be more hands thus allowing the user to be more explicit for what they want.