# @appshell/loader

> Utility for loading Appshell components

Latest version **1.0.0-alpha.90** (published 2026-09-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @appshell/loader
pnpm add @appshell/loader
yarn add @appshell/loader
bun add @appshell/loader
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.0-alpha.90 |
| Published | 2026-09-12 |
| First published | 2023-03-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Robert Hamilton |
| Maintainers | navaris |
| Keywords | module federation, micro-frontends, appshell |

## Links

- npm: https://www.npmjs.com/package/@appshell/loader
- Repository: https://github.com/appshellhq/appshell
- Homepage: https://github.com/appshellhq/appshell#readme
- Issues: https://github.com/appshellhq/appshell/issues
- npm.io page: https://npm.io/package/@appshell/loader

## Recent versions

- 1.0.0-alpha.90 (latest) — 2026-09-12
- 1.0.0-alpha.89 — 2026-09-12
- 1.0.0-alpha.88 — 2026-09-12
- 1.0.0-alpha.87 — 2026-09-12
- 1.0.0-alpha.86 — 2026-09-12
- 1.0.0-alpha.85 — 2026-09-12
- 1.0.0-alpha.84 — 2026-09-12
- 1.0.0-alpha.83 — 2026-09-12
- 1.0.0-alpha.82 — 2026-09-12
- 1.0.0-alpha.81 — 2026-09-11
- 1.0.0-alpha.80 — 2026-09-11
- 1.0.0-alpha.79 — 2026-09-11
- 1.0.0-alpha.78 — 2026-09-11
- 1.0.0-alpha.77 — 2026-09-11
- 1.0.0-alpha.76 — 2026-09-11
- … 93 more at https://npm.io/package/@appshell/loader/versions

## README

<div align="center">
  <a href="https://github.com/navaris/appshell">
    <picture>
      <source media="(prefers-color-scheme: dark)" srcset="https://github.com/navaris/appshell/blob/main/assets/branding/appshell-logo-white_2x.png">
      <img alt="appshell" src="https://github.com/navaris/appshell/blob/main/assets/branding/appshell-logo_2x.png">
    </picture>
  </a>
</div>

[![Appshell CI](https://github.com/navaris/appshell/actions/workflows/pipeline.yml/badge.svg)](https://github.com/navaris/appshell/actions/workflows/pipeline.yml)

# @appshell/loader

Dynamically load Appshell components for micro-frontends built with Appshell and Webpack Module federation.

Working examples can be found [here](https://github.com/navaris/appshell/tree/main/examples).

## Getting Started

To begin, you'll need to install `@appshell/loader`:

```console
npm install @appshell/loader
```

or

```console
yarn add @appshell/loader
```

or

```console
pnpm add @appshell/loader
```

The default export is the loader factory. It returns an async function that resolves a remote
key and loads the component behind it. It needs no configuration — the composition is read
from the document the registry served.

```ts
import componentLoader from '@appshell/loader';

const load = componentLoader();

const Component = load<MyComponent>('MyModule/MyComponent');

render(<Component />);
```

**Where does the composition come from?**

> The registry inlines it into the document it serves, as `window.__appshell_config__`.

## How a remote is resolved

The loader walks a chain of resolvers and uses the first one that answers:

| Resolver           | Source                                    | When it answers                                                            |
| ------------------ | ----------------------------------------- | -------------------------------------------------------------------------- |
| `inlineResolver`   | `window.__appshell_config__`              | The registry served the page and inlined the composition. No network call. |
| `registryResolver` | `GET /v1/applications/:id/remotes/:key`   | The remote was activated after this page was served.                       |

A package's vars are delivered into the `@appshell/runtime` store immediately before
its remote is loaded, so they are in place before the package's modules evaluate. They
arrive already merged with the application's overrides, because the registry does that
merge server side — the browser applies nothing. The package reads them with `getVars()`
from [`@appshell/runtime/vars`](../runtime/README.md).

You can bypass the chain entirely, which is mainly useful for tests and embedders:

```ts
const load = componentLoader({ resolver: myResolver });
```

**Do you have any framework specific loaders?**

> See [@appshell/react](https://www.npmjs.com/package/@appshell/react) for a `React` loader.

---
_Source: https://npm.io/package/@appshell/loader · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
