Skip to content

Instantly share code, notes, and snippets.

@julyytran
Forked from rrgayhart/require-1511.markdown
Last active May 20, 2016 11:06
Show Gist options
  • Save julyytran/1bfd996e7f70e7b163ab1e9e0cc9a5f0 to your computer and use it in GitHub Desktop.
Save julyytran/1bfd996e7f70e7b163ab1e9e0cc9a5f0 to your computer and use it in GitHub Desktop.
The Concept of Require

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 and answer the following questions:

  • In the context of Node, what is a module?

  • A module is similar to a class in Ruby. It encapsulates a chunk of code that has related functions. Needs to be exported if it wil be used in a different file from the one it is defined in.

  • The code examples from the second blog post look very different from the first. Why?

  • The second post uses RequireJS to load modules that the current module is dependent on before the current module is executed.

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