Home Manual Reference Source

projext browser target configuration

This feature allows you to have dynamic configurations on your browser targets.

For node targets, having multiple configuration files is simple, as they can require files on runtime, but in the case of browser targets, you would probably want to select the configuration you want to use when you bundle the code and be able to include it inside.

That's why, if enabled, projext creates an instance of wootil's AppConfiguration that browser targets can use on the bundling process.


The settings for this feature are on the target own settings, under the configuration key:

  type: 'browser',
  configuration: {
    enabled: false,
    default: null,
    path: 'config/',
    hasFolder: true,
    defineOn: 'process.env.CONFIG',
    environmentVariable: 'CONFIG',
    loadFromEnvironment: true,
    filenameFormat: '[target-name].[configuration-name].config.js',


Whether or not the feature is enabled.


The default configuration. It will be the base all the other, "dynamic", configuration will extend.

If not specified, projext will try to load a configuration file called [target-name].config.js, inside the configuration path.


The path relative to the root directory where the configurations are located.


If true, projext will append a folder with the name of the target on the configurations path.


The name of a variable that, when the target is builded, will be replaced with the configuration object.


The name of an environment variable where projext will check for a configuration name.


Whether or not projext should check the environment variable. This is for cases in which loading the default configuration is enough for your project.


The name format of the configuration files. [configuration-name] will be replaced with the value of the environment variable.

Using a configuration

First, let's assume the following things:

Now, you should be able to use it by sending the environment variable before the projext command:

CONFIG=debug [projext-command-to-build-a-target]

This will load config/myapp/myapp.config.js and then config/myapp/myapp.debug.js.