Skip to content

Configuration

Configuration is done through an Alliance configuration file. It contains options related to the app build and development.

The default configuration file name is alliance.config.*.

defineConfig()

Utility to get IntelliSense and documentation for values in your configuration file.

Example

ts
// alliance.config.ts
import { defineConfig } from '@telia-ace/alliance-framework/config';

export default defineConfig({
    // config
    build: {
        mode: 'development',
    },
});

The configuration can also be resolved asynchronously.

The resolver gets passed ResolverArgs from the CLI.

ResolverArgs

PropertyTypeDefaultDescription
command 'build' | 'serve'undefinedWhat CLI command was run.
mode 'production' | 'development'productionWhat mode was passed from the CLI.

Example

ts
// alliance.config.ts
import { defineConfig } from '@telia-ace/alliance-framework/config';

export default defineConfig((args) => {
    if (args.command === 'serve') {
        if (args.mode === 'production') {
            return {
                // production serve config
            };
        }
        return {
            // development serve config
        };
    }

    if (args.mode === 'production') {
        return {
            // production build config
        };
    }

    return {
        // development build config
    };
});

JSON Configuration

Configuration using JSON is also supported.

Example

json
// alliance.config.json
{
    "$schema": "https://unpkg.com/@telia-ace/alliance-framework/dist/config.schema.json",
    "build": {
        "mode": "development"
    }
}

Configuration Types

AppConfig

PropertyTypeDefaultDescription
viteViteOptionsundefinedOptions for Vite.
serverServerOptionsundefinedOptions for the dev server.
entriesEntryOptionsundefinedOptions for the app entry points.
buildBuildOptionsundefinedOptions for the app build.

EntryOptions

PropertyTypeDefaultDescription
appstring'./src/app'The entry file for the app.
manifeststring'./src/manifest'The entry file for the app manifest.

BuildOptions

PropertyTypeDefaultDescription
mode'production' | 'development''production', 'development' if watch is trueWhich mode to use when building the app.
watchboolean false Whether the build should start watching and rebuild when files change or not.

ServerOptions

PropertyTypeDefaultDescription
appsstring[] []Additional apps to include. Note: additional apps need to be added as devDependencies.
portsPortsOptionsundefinedOptions for ports.
openbooleanfalseWhether the dev server should automatically open in your browser or not.
loggingbooleanfalseWhether the dev server and browser console should output more log information or not. If you're not seeing log entries in the browser console - make sure your browser is not filtering out verbose logs. Logging can also be enabled by adding a logging=true cookie in your browser.

PortsOptions

PropertyTypeDefaultDescription
servernumber3000The port that the dev server should use.
gatewaynumber3001The port that the api gateway should use.

ViteOptions

PropertyTypeDefaultDescription
aliasAliasundefinedEquivalent to vite.resolve.alias.
pluginsPluginsundefinedEquivalent to vite.plugins.