The scope plugin implements a CommonJS-like module system. This allows for simple sharing of code and state across different resources.
The scope plugin operates by default in module-level scope mode. This behavior can be changed
through the scope
field on the lumbar configuration object.
The scope
field may either a string specifying the scoping mode or an object. If an object,
it may have the following fields:
mode
: One ofmodule
instance. This is
the default behavior.module
instance, unless overridden in the resource's local scope.module
instance is created.
This effectively disables the scope plugin. Note that other plugins may fail or require
additional configuration if operating in this mode.Additionally the scope plugin allows for specific resources to be loaded in the global scope by
specifying "global": true
on the specific resource. This is useful for 3rd party libraries such
as zepto and backbone that expect to be loaded in the global scope. Global scoped files must
appear at the beginning of a module.