I'm building nw.js app with Webpack and Angular. I would like to achieve something what I've seen and used in my other plane angular app from this boilerplate https://github.com/jakemmarsh/angularjs-gulp-browserify-boilerplate.
The following code serves for the code & modules organization, and it does a great job. In the each module there is a _index.js file which contains the following:
var bulk = require('bulk-require');
module.exports = angular.module('app.services', []);
bulk(__dirname, ['./**/!(*_index|*.spec).js']);
This exports the angular module, and then in the same directory each file just requires it, and continues using it (not quite sure but probably the one requiring it doesn't have to be in the same directory):
var app = require('./_index');
app.controller('SomeCtrl', function...);
Now for the Webpack implementation I've tried adjusting this example this:
require.context("..", true, /^grunt-[^\/]+\/tasks/[^\/]+$/);
and this is my version of it
require.context(__dirname, true, /./**/!(*_index|*.spec).js/);
I'm pretty sure my regex is not correctly applied there, so I need your help on how to make this work.
On the other hand I'm not sure on how the boilerplate's bulk-require functions, and what it does exactly. I believe that it includes all of the files somehow, because otherwise no other part of the application would know about them. So, instead including every directive, service and controller manually, I'd say it does that job for you.
Help much obliged :)