Skip to main content

Type Alias: ImaConfig

ImaConfig: object

Defined in: types.ts:139

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.

Type declaration

compress

compress: boolean

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

cssBrowsersTarget

cssBrowsersTarget: string

Browserslist configuration string for postcss-preset-env.

devServer?

optional devServer: object

HMR dev server settings.

devServer.hostname?

optional devServer.hostname: string

devServer.origin?

optional devServer.origin: string

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

devServer.port?

optional devServer.port: number

devServer.publicUrl?

optional devServer.publicUrl: string

devServer.writeToDiskFilter()?

optional devServer.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

Disables build of 'client' legacy bundle.

experiments?

optional experiments: object

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.

experiments.css?

optional experiments.css: boolean

imageInlineSizeLimit

imageInlineSizeLimit: number

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

jsxRuntime?

optional jsxRuntime: "classic" | "automatic"

Set custom jsxRuntime, the default is 'automatic'.

languages

languages: Record<string, string[]>

Supported languages with glob paths of the files with translations

plugins?

optional plugins: ImaCliPlugin[]

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>>

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

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"

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>>

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>>

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

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

Ima

namespace are included by default.

transformVendorPaths.exclude?

optional transformVendorPaths.exclude: RegExp[]

transformVendorPaths.include?

optional transformVendorPaths.include: RegExp[]

watchOptions

watchOptions: Watching["watchOptions"]

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>

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"]

Optional custom webpack aliases

prepareConfigurations()?

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[]>