Uh oh!
There was an error while loading. Please reload this page.
- 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();functionadditional(configurator,options){returnconfigurator.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();functionadditional(configurator,options){returnconfigurator.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.
If you are performing simple mutations then you may use any of the webpack-configurator methods directly on the definition.
For example, the common example above becomes:
module.exports=angularity(...).define('common').merge(...)
...
.resolve();And the test example above becomes:
module.exports=angularity(...).define('test').merge(...)
...
.resolve();The up side is that the additional function is generated and append()ed automatically.
The down side is you do not have access to the final (merged) options.
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();functionnewFactory(internalFactory,options){varconfigurator=internalFactory();configurator.foo=functionfoo(){};returnconfigurator;}functionnewerFactory(newFactory,options){varconfigurator=newFactory();configurator.bar=functionbar(){};returnconfigurator;}For more information refer to the webpack-multi-configurator documentation on create.
Getting started
Reference
How it works