All notes
Require-contex

Intro



//---------- index.js
require.context = require('require-context');

const mockContext = require.context(".", false);
console.log(mockContext.toString());
// function(key) {
//     return require(context.resolve(key))
//   }
console.log(mockContext.keys());
// [ 'index.js', 'package.json', 'register.js' ]
console.log(mockContext.resolve.toString());
// function(key) {
//     return path.join(directory, key)
//   }

mockContext.keys().forEach((item)=>{
  console.log(mockContext.resolve(item));
});
// index.js
// package.json
// register.js

// Require all the found modules:
mockContext.keys().forEach(mockContext);