Skip to content

Instantly share code, notes, and snippets.

@erinnachen
Forked from rrgayhart/require-1511.markdown
Created May 24, 2016 13:27
Show Gist options
  • Save erinnachen/3c187e0758c4e6007c1fdbc9d23d8264 to your computer and use it in GitHub Desktop.
Save erinnachen/3c187e0758c4e6007c1fdbc9d23d8264 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?
@erinnachen
Copy link
Author

In Node, a module maps to code in a specific file. It feels like a way to create namespaces.
The second blog post uses a module loader called RequireJS. RequireJS has specific syntax associated with it. It does not seem really obvious to me that Node doesn't have the same functionality.

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