5 thoughts on “Possible to require every file in a directory?

  1. @okbel please find the way in example:

    (function () {
        var angular = require("angular");
        angular.module("core.components", []);
    
        var context = require.context(".", true, /\.js$/);
        context.keys().forEach(function (key) {
            context(key);
        });
    })();
    

    This way I define new angular module and require all js files in subdirectories.

Comments are closed.