Used to import YAML files and convert them into JavaScript objects.
YAML is a data serialization language commonly used for writing configuration files.
You can install the plugin using the following command:
You can register the plugin in the rsbuild.config.ts
file:
Suppose the project has the following code in example.yaml
:
After using the YAML plugin, you can reference it as follows:
When you import YAML files in TypeScript code, please create a src/env.d.ts
file in your project and add the corresponding type declarations.
@rsbuild/core
package is installed, you can directly reference the type declarations provided by @rsbuild/core
: