> For the complete documentation index, see [llms.txt](https://coldbox-elixir.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://coldbox-elixir.ortusbooks.com/v3/writing_elixir_extensions.md).

# Writing Elixir Extensions

## `mergeConfig`

Occasionally you will need to extend Webpack in ways not supported by ColdBox Elixir. In these moments, you can provide your own configuration using the `mergeConfig` method.

```javascript
const elixir = require("coldbox-elixir");

elixir.config.mergeConfig({
    // custom webpack config goes here
});
```

The `mergeConfig` method will merge the object provided with the existing Webpack config using the excellent [`webpack-merge` library](https://github.com/survivejs/webpack-merge).

## Custom Ingredients

Ingredients are the name for the methods available on the `mix` object. You can add an ingredient to your Elixir instance like so:

```javascript
const elixir = require("coldbox-elixir");

elixir.config.addIngredient("nameOfIngredient", () => {
    // function to run when called (mix.nameOfIngredient());
    // any parameters passed to the `mix.nameOfIngredient()` call will be available in the function.
    // The `this` scope refers to the ElixirConfig object, so methods like `this.mergeConfig` are available.
})
```

The main use cases for using an ingredient over custom config are:

1. Need to call multiple times each time for different file(s)
2. Want to re-use across projects

Especially in the second case, feel free to publish the ingredient on NPM if you feel it could be useful to other developers.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://coldbox-elixir.ortusbooks.com/v3/writing_elixir_extensions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
