Skip to content

Instantly share code, notes, and snippets.

@brianrip
Forked from rrgayhart/require-1511.markdown
Last active May 27, 2016 03:18
Show Gist options
  • Save brianrip/8c3cfb388e591e7f0be1e4a9ce1edbce to your computer and use it in GitHub Desktop.
Save brianrip/8c3cfb388e591e7f0be1e4a9ce1edbce 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 a reference to code that is contained within a specific file so that it can be exported to be used in other files/namespaces.

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

With requireJS you able to define a module using a syntax called directly on the code you want to be able to export. You are then able to call that module elseware to apply it toward code within a seperate namespace.

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