سؤال

Is there a way do do wildcard/regex mapping in requirejs? Something like this:

{
    map: {
        'controllers/.+' : {
            'controllers/(.+)' : 'notAllowedModuleThatThrowsError$1', //$1 is capture group if wanted
        }
    }
}

I basically want this as the example show, to enforce a good structure (MVC or otherwise) in my application I want to prevent certain modules from getting access to certain other modules.

هل كانت مفيدة؟

المحلول

There is no such support for this in RequireJS right now. In case you wonder, the "*" notation is not handled through pattern matching.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top