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
?
It's a synonym for script. It's a small chunk of js code that serves a specific purpose. Byt splitting out code up into modules, it makes it easier to organize.
- The code examples from the second blog post look very different from the first. Why?
RequireJS allows for asynchronous module loading, and in doing so, wraps the module in the "define" function. Parameters of define function include other modules on which it is dependant.