Skip to main content

Interface: ImaCliPlugin

@ima/cli.ImaCliPlugin

Interface for ima/cli plugins that can be defined in plugins field in ima.conf.js. These can be used to extend functionality of default CLI with custom cli arguments and webpack config overrides.

Properties

cliArgs

Optional Readonly cliArgs: Partial<Record<ImaCliCommand, CommandBuilder>>

Optional additional CLI arguments to extend the set of existing ones.

Defined in

types.ts:96


name

Readonly name: string

Plugin name, used mainly for better debugging messages.

Defined in

types.ts:91

Methods

postProcess

Optional postProcess(args, imaConfig): Promise<void>

Optional plugin hook to do some custom processing after the compilation has finished. Attention! This hook runs only for build command.

Parameters

NameType
argsImaCliArgs
imaConfigImaConfig

Returns

Promise<void>

Defined in

types.ts:129


preProcess

Optional preProcess(args, imaConfig): Promise<void>

Optional plugin hook to do some pre processing right after the cli args are processed and the imaConfig is loaded, before the webpack config creation and compiler run.

Parameters

NameType
argsImaCliArgs
imaConfigImaConfig

Returns

Promise<void>

Defined in

types.ts:102


prepareConfigurations

Optional prepareConfigurations(configurations, imaConfig, args): Promise<ImaConfigurationContext[]>

Called right before creating webpack configurations after preProcess call. This hook lets you customize configuration contexts for each webpack config that will be generated. This is usefull when you need to overrite configuration contexts for values that are not editable anywhere else (like output folders).

Parameters

NameType
configurationsImaConfigurationContext[]
imaConfigImaConfig
argsImaCliArgs

Returns

Promise<ImaConfigurationContext[]>

Defined in

types.ts:110


webpack

Optional webpack(config, ctx, imaConfig): Promise<Configuration>

Webpack callback function used by plugins to customize/extend ima webpack config before it's run.

Parameters

NameType
configConfiguration
ctxImaConfigurationContext
imaConfigImaConfig

Returns

Promise<Configuration>

Defined in

types.ts:119