Module: @ima/cli
Interfaces
Type Aliases
ImaCliCommand
Ƭ ImaCliCommand: "build"
| "dev"
Ima CLI commands.
Defined in
ImaConfig
Ƭ ImaConfig: Object
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
Name | Type | Description |
---|---|---|
compress | boolean | Enable brotli and gzip compression for production assets [default=true]. |
devServer? | { hostname? : string ; port? : number ; publicUrl? : string ; writeToDiskFilter? : (filePath : string ) => boolean } | HMR dev server settings. |
devServer.hostname? | string | - |
devServer.port? | number | - |
devServer.publicUrl? | string | - |
devServer.writeToDiskFilter? | (filePath : string ) => 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. |
disableLegacyBuild? | boolean | Disables build of 'client' legacy bundle. |
experiments? | { css? : boolean } | 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? | boolean | - |
imageInlineSizeLimit | number | Threshold to inline image resources as base64 automatically [default=8192] |
jsxRuntime? | "classic" | "automatic" | Set custom jsxRuntime, the default is 'automatic'. |
languages | Record <string , string []> | Supported languages with glob paths of the files with translations |
plugins? | ImaCliPlugin [] | Optional IMA cli plugins that can be used to easily extend webpack config and cli with additional features. |
postcss | (config : Record <string , unknown >, ctx : ImaConfigurationContext ) => 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. |
publicPath | string | Webpack assets public path [default=''] |
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 | (config : Record <string , unknown >, ctx : ImaConfigurationContext ) => 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. |
swcVendor | (config : Record <string , unknown >, ctx : ImaConfigurationContext ) => 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. |
transformVendorPaths? | { exclude? : RegExp [] ; include? : RegExp [] } | 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? | RegExp [] | - |
transformVendorPaths.include? | RegExp [] | - |
watchOptions | Watching ["watchOptions" ] | Custom options passed to webpack watch api interface. For more information see: https://webpack.js.org/configuration/watch/#watchoptions |
webpack? | (config : Configuration , ctx : ImaConfigurationContext , imaConfig : ImaConfig ) => Promise <Configuration > | Webpack callback function can be used to completely customize default webpack config before it's run. |
webpackAliases? | ResolveOptions ["alias" ] | Optional custom webpack aliases |
Defined in
Functions
resolveEnvironment
▸ resolveEnvironment(rootDir?
): ImaEnvironment
Loads application IMA.js environment from server/config/environment.js
Parameters
Name | Type | Description |
---|---|---|
rootDir | string | Application root directory |
Returns
Loaded environment
Defined in
packages/cli/src/webpack/utils.ts:26
resolveImaConfig
▸ resolveImaConfig(args
): Promise
<ImaConfig
>
Resolves ima.config.js from rootDir base path with DEFAULTS.
Parameters
Name | Type | Description |
---|---|---|
args | ImaCliArgs | CLI args. |
Returns
Promise
<ImaConfig
>
Ima config or empty object.