Skip to content

Instantly share code, notes, and snippets.

@damwhit
Forked from rrgayhart/require-1511.markdown
Last active May 24, 2016 04:40
Show Gist options
  • Save damwhit/cbb1d0d4e639e7146b9fe64b89306901 to your computer and use it in GitHub Desktop.
Save damwhit/cbb1d0d4e639e7146b9fe64b89306901 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 maps directly to a file. A module is private until it is exported using module.exports and imported using require.
  • The code examples from the second blog post look very different from the first. Why?
  • The second post is about using requireJS. This uses something called define to initialize a module vs defining a prototype class like when using node modules.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment