Skip to content

Instantly share code, notes, and snippets.

@s-espinosa
Forked from rrgayhart/require-1602.markdown
Last active July 8, 2016 07:11
Show Gist options
  • Save s-espinosa/fae8cbc3a6b95a6311e154e2a071e01d to your computer and use it in GitHub Desktop.
Save s-espinosa/fae8cbc3a6b95a6311e154e2a071e01d 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? In node a module is any file that includes a 'module.exports' statement allowing that code to be required in other files.
  • The code examples from the second blog post look very different from the first. Why? The second blog post is using RequireJS to achieve basically the same effect with different syntax. It seems as though RequireJS only allows access to the imported functions when wrapped in a require function.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment