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 containing element for related pieces of code. Often a separate .js file, modules are used to organize and pass along information to other files using the require() syntax.
- A
- The code examples from the second blog post look very different from the first. Why?
- The second blog post uses a
define
method instead ofrequire
to specify the modules needed to perform a function using RequireJS. Not entirely clear on when or why to use one over the other.
- The second blog post uses a