Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions website/docs/en/guide/advanced/json-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,16 @@ export { __webpack_exports__items as items, __webpack_exports__name as name };

</Tabs>

### Use import attributes

In bundle mode, Rslib supports [import attributes](https://github.com/tc39/proposal-import-attributes), and you can import JSON files through import attributes:

```js title="index.js"
import json from './example.json' with { type: 'json' };
```

In bundleless mode, when importing JSON files through import attributes, you need to ensure that references to the JSON files are preserved in the output, refer to [document](#bundleless) for configuration.

## YAML file

[YAML](https://yaml.org/) is a data serialization language commonly used for writing configuration files.
Expand Down
10 changes: 10 additions & 0 deletions website/docs/zh/guide/advanced/json-files.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ export { __webpack_exports__items as items, __webpack_exports__name as name };

</Tabs>

### 使用 import attributes

在 bundle 模式下,Rslib 支持 [import attributes](https://github.com/tc39/proposal-import-attributes),你可以通过 import attributes 来引入 JSON 文件:

```js title="index.js"
import json from './example.json' with { type: 'json' };
```

在 bundleless 模式下,通过 import attributes 引入 JSON 文件时,需要确保产物中保留对 JSON 文件的引用,参考 [文档](#bundleless) 进行配置。

## YAML 文件

[YAML](https://yaml.org/) 是一种数据序列化语言,通常用于编写配置文件。
Expand Down
Loading