Home Reference Source
public class | source

WebpackConfiguration

This service reads the targets information and generates what would be the contents of a webpack.config.js for them.

Constructor Summary

Public Constructor
public

constructor(buildVersion: BuildVersion, pathUtils: PathUtils, targets: Targets, targetsFileRules: TargetsFileRules, targetConfiguration: TargetConfigurationCreator, webpackConfigurations: WebpackConfigurations)

Class constructor.

Member Summary

Public Members
public

A local reference for the buildVersion service.

public

A local reference for the pathUtils service.

public

A local reference for the targetConfiguration function service.

public

A local reference for the targets service.

public

A local reference for the targetsFileRules service.

public

A dictionary with the configurations for target type and build type.

Method Summary

Public Methods
public

getConfig(target: Target, buildType: string): Object

This method generates a complete webpack configuration for a target.

Public Constructors

public constructor(buildVersion: BuildVersion, pathUtils: PathUtils, targets: Targets, targetsFileRules: TargetsFileRules, targetConfiguration: TargetConfigurationCreator, webpackConfigurations: WebpackConfigurations) source

Class constructor.

Params:

NameTypeAttributeDescription
buildVersion BuildVersion

To load the project version.

pathUtils PathUtils

To generate the Webpack paths.

targets Targets

To get the target information.

targetsFileRules TargetsFileRules

To get the file rules of the target.

targetConfiguration TargetConfigurationCreator

To create an overwrite configuration for the target.

webpackConfigurations WebpackConfigurations

A dictionary of configurations for target type and build type.

Public Members

public buildVersion: BuildVersion source

A local reference for the buildVersion service.

public pathUtils: PathUtils source

A local reference for the pathUtils service.

public targetConfiguration: TargetConfigurationCreator source

A local reference for the targetConfiguration function service.

public targets: Targets source

A local reference for the targets service.

public targetsFileRules: TargetsFileRules source

A local reference for the targetsFileRules service.

public webpackConfigurations: WebpackConfigurations source

A dictionary with the configurations for target type and build type.

Public Methods

public getConfig(target: Target, buildType: string): Object source

This method generates a complete webpack configuration for a target. Before creating the configuration, it uses the reducer event webpack-configuration-parameters-for-browser or webpack-configuration-parameters-for-node, depending on the target type, and then webpack-configuration-parameters to reduce the parameters (WebpackConfigurationParams) the services will use to generate the configuration. The event recevies the parameters and expects updated parameters in return.

Params:

NameTypeAttributeDescription
target Target

The target information.

buildType string

The intended build type: production or development.

Return:

Object

Throw:

Error

If there's no base configuration for the target type.

Error

If there's no base configuration for the target type and build type.

TODO:

  • Stop using `events` from `targets` and inject it directly on the class.