-
Notifications
You must be signed in to change notification settings - Fork 2
extensibility
You may call the define()
method to adjust the structure at any time. You do not need to edit this package.
To adjust all modes, you would append()
an operation to the common
definition. This may be done at any time before resolve()
is called.
module.exports = angularity(...)
.define('common')
.append(additional)
...
.resolve();
function additional(configurator, options) {
return configurator
.merge(...);
}
If you want to adjust the configuration for a specific mode, you would append()
and operation to the definition of that same mode. This may be done at any time before resolve()
is called.
module.exports = angularity(...)
.define('test')
.append(additional)
...
.resolve();
function additional(configurator, options) {
return configurator
.merge(...);
}
Each operation is passed the existing configurator
, and the final (merged) options
. It should return a configurator, usually the same instance as that provided.
For more details refer to the webpack-multi-configurator
documentation on definition.
For specific examples refer to the how do I ...? documentation.
By changing the factory function you can add custom methods to the webpack-configurator
instance.
You may do so by calling the create()
method. This method normally is used to refine options, but it may also be passed a new factory function.
Interestingly the export from this package is actually the create()
function. So you can use the initial invocation or call create()
at any time following.
If you specify a new factory function it will be passed the previous factory
, and the final (merged) options
. In this way you can redefine the webpack-configurator
instance to your liking.
In the following example we first extend the configurator with foo()
and then extend it with bar()
.
module.exports = angularity({...}, newFactory)
...
.create({...}, newerFactory)
...
.resolve();
function newFactory(internalFactory, options) {
var configurator = internalFactory();
configurator.foo = function foo(){};
return configurator;
}
function newerFactory(newFactory, options) {
var configurator = newFactory();
configurator.bar = function bar(){};
return configurator;
}
For more information refer to the webpack-multi-configurator
documentation on create.
-
Getting started
-
Reference
-
How it works