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 piece of your javascript code that could contain a class, or functions, or variables that are common or related to each other and warrant their own file.
-
The code examples from the second blog post look very different from the first. Why?
- The first blog post uses what we've been shown before,
module.exportswhereas the second post uses adefinefunction. Thedefinefunction comes from a different javascript module loaderRequireJS, andmodule.exportscomes fromCommonJS.
- The first blog post uses what we've been shown before,