Length | Points | Week |
---|---|---|
20 minutes | 10 | Week 2 |
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
- Fork This Gist
- Respond in your forked gist with answers to the following questions
- In the context of Node, what is a
module
?module
is a fundamental building block that maps to a file. In Node - variables, functions and classes are only visible to other things in the same file. To make them accessible with a require statement you have to use havemodule.exports = Thing;
in the file.
- The code examples from the second blog post look very different from the first. Why?
- in this article something different is utilized to make parts of one module available to another file/module, RequireJS.
- RequireJS looks at the dependencies of all the modules in your application, and will fetch and execute all of the modules in the proper order so that each module has exactly what it needs to run.
- In the context of Node, what is a