Skip to content

Instantly share code, notes, and snippets.

@rrgayhart
Created May 16, 2016 19:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
  • Save rrgayhart/dca2796a0aa3f43ccf98e43973dec933 to your computer and use it in GitHub Desktop.
Save rrgayhart/dca2796a0aa3f43ccf98e43973dec933 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?
  • The code examples from the second blog post look very different from the first. Why?
@scottfirestone
Copy link

  • A module is an encapsulation of code that selectively exposes itself to the outside.
    -The second blog post deals with RequireJS, which has modules load dependencies upfront to help with browser loading, and has different syntax than Node's built-in loader.

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