Skip to content

Instantly share code, notes, and snippets.

@adamhundley
Forked from rrgayhart/require-1511.markdown
Created May 23, 2016 22:33
Show Gist options
  • Save adamhundley/8ce631c8613e31a082a33cb6216d2ea4 to your computer and use it in GitHub Desktop.
Save adamhundley/8ce631c8613e31a082a33cb6216d2ea4 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?
@adamhundley
Copy link
Author

  • A module is a small chunk of code that only knows about what is contained in itself. It must be exported in order for the outside world to have access to it.
  • He is using RequireJS which has a very different syntax than Node's for exporting and importing modules. The use for the standard seems much more straight foreword.

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