Skip to main content

Type Alias: ImaConfig

ImaConfig = object

Defined in: types.ts:144

Ima config options. Some of these options can be overridden using Args, which takes precedence. These are parsed from optional ima.config.js that can be defined in the root of the IMA.js project.

Properties

compress

compress: boolean

Defined in: types.ts:278

Enable brotli and gzip compression for production assets [default=true].


cssBrowsersTarget

cssBrowsersTarget: string

Defined in: types.ts:196

Browserslist configuration string for postcss-preset-env.


devServer?

optional devServer: object

Defined in: types.ts:212

HMR dev server settings.

hostname?

optional hostname: string

origin?

optional origin: string

Optional custom ima app origin (defaults to http://localhost:[environment.$Server.port]) this is used for CORS configuration.

port?

optional port: number

publicUrl?

optional publicUrl: string

writeToDiskFilter()?

optional writeToDiskFilter: (filePath) => boolean

Custom filtr for files which should be always written to disk, even if we're serving static files from memory. This is used for example to always save runner.js to disk, since it's used on server-side too.

Parameters
filePath

string

Returns

boolean


disableLegacyBuild?

optional disableLegacyBuild: boolean

Defined in: types.ts:298

Disables build of 'client' legacy bundle.


experiments?

optional experiments: object

Defined in: types.ts:315

Experimental configurations which can be enabled individually on specific applications. Some of these may find a way to default configuration in future versions of IMA.js.

css?

optional css: boolean


imageInlineSizeLimit

imageInlineSizeLimit: number

Defined in: types.ts:283

Threshold to inline image resources as base64 automatically [default=8192]


jsxRuntime?

optional jsxRuntime: "classic" | "automatic"

Defined in: types.ts:273

Set custom jsxRuntime, the default is 'automatic'.


languages

languages: Record<string, string[]>

Defined in: types.ts:293

Supported languages with glob paths of the files with translations


plugins?

optional plugins: ImaCliPlugin[]

Defined in: types.ts:202

Optional IMA cli plugins that can be used to easily extend webpack config and cli with additional features.


postcss()

postcss: (config, ctx) => Promise<Record<string, unknown>>

Defined in: types.ts:176

Function which receives postcss-loader config and current context, this can be used to customize existing default postcss config or completely replace it with a custom one.

Parameters

config

Record<string, unknown>

ctx

ImaConfigurationContext

Returns

Promise<Record<string, unknown>>


publicPath

publicPath: string

Defined in: types.ts:207

Webpack assets public path [default='']


sourceMaps?

optional sourceMaps: boolean | "eval" | "eval-cheap-source-map" | "eval-cheap-module-source-map" | "eval-source-map" | "cheap-source-map" | "cheap-module-source-map" | "source-map" | "inline-cheap-source-map" | "inline-cheap-module-source-map" | "inline-source-map" | "eval-nosources-cheap-source-map" | "eval-nosources-cheap-module-source-map" | "eval-nosources-source-map" | "inline-nosources-cheap-source-map" | "inline-nosources-cheap-module-source-map" | "inline-nosources-source-map" | "nosources-cheap-source-map" | "nosources-cheap-module-source-map" | "nosources-source-map" | "hidden-nosources-cheap-source-map" | "hidden-nosources-cheap-module-source-map" | "hidden-nosources-source-map" | "hidden-cheap-source-map" | "hidden-cheap-module-source-map" | "hidden-source-map"

Defined in: types.ts:242

Set to true (or any preset from https://webpack.js.org/configuration/devtool/#devtool) to enable source maps for production build. (dev/watch tasks always generate source maps to work properly with error overlay).


swc()

swc: (config, ctx) => Promise<Record<string, unknown>>

Defined in: types.ts:158

Function which receives default app swc-loader config and current context, this can be used for additional customization or returning completely different config.

Parameters

config

Record<string, unknown>

ctx

ImaConfigurationContext

Returns

Promise<Record<string, unknown>>


swcVendor()

swcVendor: (config, ctx) => Promise<Record<string, unknown>>

Defined in: types.ts:167

Function which receives default vendor swc-loader config and current context, this can be used for additional customization of vendor processed files.

Parameters

config

Record<string, unknown>

ctx

ImaConfigurationContext

Returns

Promise<Record<string, unknown>>


transformVendorPaths?

optional transformVendorPaths: object

Defined in: types.ts:306

Advanced functionality allowing you to include/exclude custom vendor paths that go through swc loader (configured using swcVendor function). Use this if you're using dependencies that don't meet the lowest supported ES version target (ES9 by default). all packages in

exclude?

optional exclude: RegExp[]

include?

optional include: RegExp[]

Ima

namespace are included by default.


watchOptions

watchOptions: Watching["watchOptions"]

Defined in: types.ts:235

Custom options passed to webpack watch api interface. For more information see: https://webpack.js.org/configuration/watch/#watchoptions


webpack()?

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

Defined in: types.ts:148

Webpack callback function can be used to completely customize default webpack config before it's run.

Parameters

config

Configuration

ctx

ImaConfigurationContext

imaConfig

ImaConfig

Returns

Promise<Configuration>


webpackAliases?

optional webpackAliases: ResolveOptions["alias"]

Defined in: types.ts:288

Optional custom webpack aliases

Methods

prepareConfigurations()?

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

Defined in: types.ts:187

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

configurations

ImaConfigurationContext[]

imaConfig

ImaConfig

args

ImaCliArgs

Returns

Promise<ImaConfigurationContext[]>