# Exports configuration

{% hint style="info" %}
Make sure to create the **`.omletrc`** file in the root directory of your repository before getting started.
{% endhint %}

The **`exports`** property is a series of entries that tells the CLI about the corresponding entry points of a package in the source code.

If your design system library is used in your application repositories as an external package, you can define the **`exports`** property to tell the CLI where the entry points of a package correspond in the source code.

This is very similar to the Node.js [package entry point](https://nodejs.org/api/packages.html#exports) configuration (i.e., **`exports`** and **`main`** fields of the **`package.json`** file). The difference is, unlike Node.js exports mapping, these patterns should point to the corresponding source module for each package export.

{% hint style="info" %}
The Omlet CLI follows the same format and convention as Node.js for the exports configuration—except for the conditional exports. The main entry point,<mark style="color:blue;">**`import { … } "@acme/design-system"`**</mark>, is designated with "."
{% endhint %}

Let's say there's a project with the following structure:

<figure><img src="/files/GjdOhPb019AuAdkRolfS" alt=""><figcaption></figcaption></figure>

If the **`package.json`** file has the entry point defined via the **`main`** field:

<pre class="language-json" data-title="package.json" data-line-numbers><code class="lang-json">{
  "name": "@acme/design-system",
<strong>  "main": "build/index.js"
</strong>}
</code></pre>

The following configuration is needed so that the CLI can map exported modules and names to their corresponding sources:

{% code title=".omletrc" lineNumbers="true" %}

```json
{
  "exports": {
    ".": "src/index.ts"
  }
}
```

{% endcode %}

If you have a more complex entry-point setup in the **`package.json`** file similar to the following:

{% code title="package.json" lineNumbers="true" %}

```json
{
  "name": "@acme/design-system",
  "exports": {
    ".": "./build/index.js",
    "./lib": "./build/lib/index.js",
    "./lib/*": "./build/lib/*.js",
    "./lib/*.js": "./build/lib/*.js",
    "./feature": "./build/feature/index.js"
  }
}
```

{% endcode %}

Then, the corresponding export configuration should look like this:

{% code title=".omletrc" lineNumbers="true" %}

```json
{
  "exports": {
    ".": "./src/index.ts",
    "./lib": "./src/lib/index.ts",
    "./lib/*": "./src/lib/*.tjs",
    "./lib/*.js": "./src/lib/*.ts",
    "./feature": "./src/feature/index.ts"
  }
}
```

{% endcode %}

If you have a monorepo, you can define package-specific **`exports`** configurations using the **`workspaces`** field.

<pre class="language-json" data-title=".omletrc" data-line-numbers><code class="lang-json">{
<strong>  "workspaces": {
</strong><strong>    "@acme/design-system": {
</strong><strong>      "exports": {
</strong><strong>        ".": "./src/index.ts",
</strong><strong>      }
</strong><strong>    }
</strong><strong>  }
</strong>}
</code></pre>


---

# Agent Instructions: 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://docs.omlet.dev/cli-and-dashboard/learn-omlet-cli/config-file/resolve-imports-from-external-dependencies.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.
