> For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt.

# @lynx-js/cef-webview


`@lynx-js/cef-webview` is the officially maintained Lynxtron native library that
provides the CEF-backed [`<webview>`](/next/api/elements/built-in/webview.md) element.
It ships platform-specific Lynxtron native artifacts and a `./lynxtron` entry
that loads the current platform artifact so its static Lynx registrations run in
the host process.

:::note Tooling Version

For the matching AutoLink tooling and automatic packaging setup, see the [webview setup guide](/next/lynxtron/Native-Libraries/Officially-Maintained-Libraries/cef-webview-getting-started.md).

:::

## Install


```sh [npm]
npm install @lynx-js/cef-webview
```

```sh [yarn]
yarn add @lynx-js/cef-webview
```

```sh [pnpm]
pnpm add @lynx-js/cef-webview
```

```sh [bun]
bun add @lynx-js/cef-webview
```

```sh [deno]
deno add npm:@lynx-js/cef-webview
```

## Host Entry

Import the Lynxtron entry in the main process before creating a `LynxWindow` or
loading a Lynx bundle:

```ts
import { app } from '@lynx-js/lynxtron';
import cefWebview from '@lynx-js/cef-webview/lynxtron';

app.whenReady().then(() => {
  cefWebview.initialize();
  // Create LynxWindow instances after this call.
});
```

The `initialize()` method initializes Chromium Embedded Framework (CEF) for the
current process. AutoLink also uses the `./lynxtron` entry when staging the
package for a Lynxtron host build.

### Initialization Result and Process Limit

`initialize(): boolean` returns `true` on success and throws when native initialization fails. Do not continue creating WebViews after a failure; inspect the native logs for the cause.

CEF selects its storage directory based on the host application's identity. Multiple instances sharing the same identity may encounter storage conflicts. One host can create multiple WebViews. A storage conflict is one possible initialization failure, not the only cause.

The root and `./lynxtron` exports include TypeScript declarations for this host API.

## Exports

| Export           | Description                                                        |
| ---------------- | ------------------------------------------------------------------ |
| `.`              | CommonJS package entry.                                            |
| `./lynxtron`     | Lynxtron host entry that loads the current platform native binary. |
| `./package.json` | Package metadata.                                                  |

## Package Metadata

The package includes `lynx.lib.json` with Lynxtron metadata. The following
excerpt abbreviates the complete platform matrix and Windows runtime file list:

```json
{
  "platforms": {
    "lynxtron": {
      "targets": [
        {
          "os": "darwin",
          "arch": "arm64",
          "files": ["dist/darwin/arm64/cef_extension.node"],
          "frameworks": [
            "dist/darwin/arm64/frameworks/Chromium Embedded Framework.framework"
          ],
          "appBundles": [
            "dist/darwin/arm64/frameworks/LynxtronWebview Helper.app",
            "dist/darwin/arm64/frameworks/LynxtronWebview Helper (Alerts).app",
            "dist/darwin/arm64/frameworks/LynxtronWebview Helper (GPU).app",
            "dist/darwin/arm64/frameworks/LynxtronWebview Helper (Plugin).app",
            "dist/darwin/arm64/frameworks/LynxtronWebview Helper (Renderer).app"
          ]
        },
        {
          "os": "win32",
          "arch": "x64",
          "files": [
            "dist/win32/x64/cef_extension.node",
            "dist/win32/x64/cef_subprocess.exe",
            "dist/win32/x64/libcef.dll",
            "dist/win32/x64/locales"
          ]
        }
      ]
    }
  }
}
```

`files` lists payloads that remain together in the installed package.
`frameworks` and `appBundles` list macOS bundles that the builder places in
`Contents/Frameworks`; nested applications are also included in the host's
signing flow.

For the end-to-end setup flow, see
[Using webview in Lynxtron](/next/lynxtron/Native-Libraries/Officially-Maintained-Libraries/cef-webview-getting-started.md).
