Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save deborahleehamel/badb58f75c6bd0a7fcd90d7cf41267bc to your computer and use it in GitHub Desktop.
Save deborahleehamel/badb58f75c6bd0a7fcd90d7cf41267bc to your computer and use it in GitHub Desktop.
Length Points Week
20 minutes 10 Week 2

The Concept of Require - Research

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.

Deliverable

  • 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 have module.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.

Additional Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment