Top "Require" questions

In interpreted languages like Lua, PHP and Ruby, "require" is a statement that tells the interpreter to include a certain source-file at that position where the "require" statement has been placed.

How does require() in node.js work?

I tried this: // mod.js var a = 1; this.b = 2; exports.c = 3; // test.js var mod = require('./mod.js'); console.…

javascript node.js this require apply
How to require some lib files from anywhere

I'll explain my situation. Here is my file tree in my rails application : lib/my_module.rb require 'my_module/…

ruby-on-rails ruby require
Why does Ruby 1.9.2 remove "." from LOAD_PATH, and what's the alternative?

The latest changesets to Ruby 1.9.2 no longer make the current directory . part of your LOAD_PATH. I have a non-trivial …

ruby rake require load-path
webpack: import + module.exports in the same module caused error

I'm developing a website with webpack. When I have a code like this: import $ from 'jquery'; function foo() {}; module.exports = …

javascript import webpack ecmascript-6 require
How to remove module after "require" in node.js?

Let say, after I require a module and do something as below: var b = require('./b.js'); --- do …

node.js module require
passing parameters to php include/require construct

I've read quite a few posts that are very similar to the question I'm about to ask, but I just …

php parameters include require
Ruby require 'file' and relative location

So I'm writing some rspec tests and I'm embarrassed at my lack of Ruby understanding. I have a file structure …

ruby require ruby-1.8 ruby-1.8.7 ruby-1.9.1
NodeJS required module not available in other modules

I'm a bit new to NodeJS. Maybe it's just the way it works but to be sure: My 'index.js': …

node.js module require
nodeJS require.paths resolve problem

I am trying to require a file relatively and mysteriously the following is happening This works well which points to /…

javascript node.js relative-path require commonjs
ES6 import equivalent of require() without exports

By using require(./filename) I can include and execute the code inside filename without any export defined inside filename itself. …

javascript node.js ecmascript-6 require javascript-import