The primary routine of mortal-webpack
: turn a bunch of build directives into a webpack
configuration object.
Example usage:
const { compose, builders: b } = require('mortal-webpack')
const webpackConfig = compose([
b.output({ path: 'dist/' }),
b.generateCommonBundle({
name: 'vendor',
modules: [ 'lodash', 'react' ]
}),
b.generateBundle({
name: 'application',
modules: [ 'src/index.js' ]
})
])
options | Object |
options.happyPackOptions | Object? |
directives | Array.<Directive> The list of directives that describe what the configuration should contain. This list is flattened before consumption in order to allow for builders and macros to return multiple directives from the same API. For example, the following two calls are equivalent:
Please keep in mind that every item in this list must be a builders~Directive and can not be falsey; if you need to conditionally add a directive, use helpers like builders.when and builders.whenEnv.
The reason for this is that we always want to evaluate the directives
to make the output more predictable. Short-circuiting using the |
Config|InvalidConfig The configuration object that can be passed to webpack. In the case of an error, an instance of InvalidConfig will be returned which you can utilize to let the user know what went wrong. |