Skip to content

Instantly share code, notes, and snippets.

@brantwellman
Forked from rrgayhart/require.markdown
Last active April 3, 2016 18:21
Show Gist options
  • Save brantwellman/8272b8d98ac06563106d6681c3aa4cdc to your computer and use it in GitHub Desktop.
Save brantwellman/8272b8d98ac06563106d6681c3aa4cdc 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 the "fundamental Node building block". It maps directly to a file. Code within that file/module is only available to other code within that module unless it is exported.
  • The code examples from the second blog post look very different from the first. Why?
    • The code in the second blog post uses RequireJS. In this case you use the define() function instead of using require.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment