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

# Interface: ExternalBundleLibConfig

`defineExternalBundleRslibConfig` 接受的 Rslib 配置结构。

## Extends

- `LibConfig`

## Properties

### autoExtension?

> `optional` **autoExtension?**: `boolean`

是否根据 [format](#format) 选项自动设置 JavaScript 输出文件的扩展名。

#### Default Value

`true`

#### See

[https://rslib.rs/config/lib/auto-extension](https://rslib.rs/config/lib/auto-extension)

#### Inherited from

`LibConfig.autoExtension`

***

### ~~autoExternal?~~

> `optional` **autoExternal?**: `AutoExternal`

是否自动将不同依赖类型的依赖外部化，而不将它们打包进 bundle。

#### Deprecated

请改用 `output.autoExternal`。

#### Default Value

当 [format](#format) 为 `cjs` 或 `esm` 时为 `true`，当 [format](#format) 为 `umd` 或 `mf` 时为 `false`。

#### See

[https://rslib.rs/config/lib/auto-external](https://rslib.rs/config/lib/auto-external)

#### Inherited from

`LibConfig.autoExternal`

***

### banner?

> `optional` **banner?**: `BannerAndFooter`

向每个 JavaScript、CSS 或声明文件的顶部注入内容。

#### Default Value

`{}`

#### See

[https://rslib.rs/config/lib/banner](https://rslib.rs/config/lib/banner)

#### Inherited from

`LibConfig.banner`

***

### bundle?

> `optional` **bundle?**: `boolean`

是否打包该库。

#### Default Value

`true`

#### See

[https://rslib.rs/config/lib/bundle](https://rslib.rs/config/lib/bundle)

#### Inherited from

`LibConfig.bundle`

***

### dev?

> `optional` **dev?**: `Pick`\<`DevConfig`, `AllowedEnvironmentDevKeys`>

本地开发相关的选项。

#### Inherited from

`LibConfig.dev`

***

### dts?

> `optional` **dts?**: `Dts`

配置 TypeScript 声明文件的生成。

#### Default Value

`false`

#### See

[https://rslib.rs/config/lib/dts](https://rslib.rs/config/lib/dts)

#### Inherited from

`LibConfig.dts`

***

### experiments?

> `optional` **experiments?**: `LibExperiments`

实验性特性相关的选项。

#### Default Value

`{}`

#### See

[https://rslib.rs/config/lib/experiments](https://rslib.rs/config/lib/experiments)

#### Inherited from

`LibConfig.experiments`

***

### externalHelpers?

> `optional` **externalHelpers?**: `boolean`

是否从 `@swc/helpers` 导入 SWC 辅助函数，而不是将其内联。

#### Default Value

`false`

#### See

[https://rslib.rs/config/lib/external-helpers](https://rslib.rs/config/lib/external-helpers)

#### Inherited from

`LibConfig.externalHelpers`

***

### footer?

> `optional` **footer?**: `BannerAndFooter`

向每个 JavaScript、CSS 或声明文件的底部注入内容。

#### Default Value

`{}`

#### See

[https://rslib.rs/config/lib/footer](https://rslib.rs/config/lib/footer)

#### Inherited from

`LibConfig.footer`

***

### format?

> `optional` **format?**: `Format`

生成的 JavaScript 文件的输出格式。

#### Default Value

`'esm'`

#### See

[https://rslib.rs/config/lib/format](https://rslib.rs/config/lib/format)

#### Inherited from

`LibConfig.format`

***

### html?

> `optional` **html?**: `HtmlConfig`

HTML 生成相关的选项。

#### Inherited from

`LibConfig.html`

***

### id?

> `optional` **id?**: `string`

该 library 的唯一标识符。

#### Default Value

`undefined`

#### See

[https://rslib.rs/config/lib/id](https://rslib.rs/config/lib/id)

#### Inherited from

`LibConfig.id`

***

### moduleFederation?

> `optional` **moduleFederation?**: `ModuleFederationConfig`

模块联邦相关的选项。

#### Inherited from

`LibConfig.moduleFederation`

***

### outBase?

> `optional` **outBase?**: `string`

输出文件的基础目录。

#### Default Value

`undefined`

#### See

[https://rslib.rs/config/lib/out-base](https://rslib.rs/config/lib/out-base)

#### Inherited from

`LibConfig.outBase`

***

### output?

> `optional` **output?**: [`OutputConfig`](/next/zh/api/packages/lynx-bundle-rslib-config/type-aliases/OutputConfig.md)

#### Inherit Doc

#### Overrides

`LibConfig.output`

***

### performance?

> `optional` **performance?**: `PerformanceConfig`

构建性能与运行时性能相关的选项。

#### Inherited from

`LibConfig.performance`

***

### plugins?

> `optional` **plugins?**: `RsbuildPlugins`

配置 Rsbuild 插件。

#### Inherited from

`LibConfig.plugins`

***

### redirect?

> `optional` **redirect?**: `Redirect`

配置导入路径的重定向，适用于 [bundle](#bundle) 设置为 `false` 的情况。

#### Default Value

`{}`

#### See

[https://rslib.rs/config/lib/redirect](https://rslib.rs/config/lib/redirect)

#### Inherited from

`LibConfig.redirect`

***

### resolve?

> `optional` **resolve?**: `ResolveConfig`

模块解析相关的选项。

#### Inherited from

`LibConfig.resolve`

***

### security?

> `optional` **security?**: `SecurityConfig`

Web 安全相关的选项。

#### Inherited from

`LibConfig.security`

***

### server?

> `optional` **server?**: `Pick`\<`ServerConfig`, `"publicDir"` | `"serveAssets"`>

配置此环境的公共目录和构建产物服务。
其他服务器选项在所有环境间共享。

#### Inherited from

`LibConfig.server`

***

### shims?

> `optional` **shims?**: `Shims`

配置 CommonJS 和 ESM 输出的 shim。

#### Default Value

```js
const defaultShims = {
  cjs: {
    'import.meta.url': true,
    'import.meta.dirname': true,
    'import.meta.filename': true,
  },
  esm: {
    __filename: false,
    __dirname: false,
    require: false,
  },
};
```

#### See

[https://rslib.rs/config/lib/shims](https://rslib.rs/config/lib/shims)

#### Inherited from

`LibConfig.shims`

***

### source?

> `optional` **source?**: `SourceConfig`

输入源代码相关的选项。

#### Inherited from

`LibConfig.source`

***

### splitChunks?

> `optional` **splitChunks?**: `false` | `SplitChunksConfig`

chunk 拆分相关的选项。

#### Inherited from

`LibConfig.splitChunks`

***

### syntax?

> `optional` **syntax?**: `Syntax`

配置 JavaScript 和 CSS 将被降级到的语法。

#### Default Value

`'esnext'`

#### See

[https://rslib.rs/config/lib/syntax](https://rslib.rs/config/lib/syntax)

#### Inherited from

`LibConfig.syntax`

***

### tools?

> `optional` **tools?**: `ToolsConfig`

底层工具相关的选项。

#### Inherited from

`LibConfig.tools`

***

### umdName?

> `optional` **umdName?**: `LibraryName`

UMD bundle 的导出名称。

#### Default Value

`undefined`

#### See

[https://rslib.rs/config/lib/umd-name](https://rslib.rs/config/lib/umd-name)

#### Inherited from

`LibConfig.umdName`

***

### wasm?

> `optional` **wasm?**: `Wasm`

配置 Rslib 如何处理 `.wasm` 模块。设为 `false` 时，ESM 的 `.wasm` 导入保持源码中的写法不变。

该选项只有在 `format` 为 `'esm'` 时才能配置。

#### Default Value

当 `bundle` 为 `true` 时为 `{ mode: 'compile' }`；当 `bundle` 为 `false` 时为 `{ mode: 'preserve' }`。

#### See

[https://rslib.rs/config/lib/wasm](https://rslib.rs/config/lib/wasm)

#### Inherited from

`LibConfig.wasm`
