From 89024c43d898b0dab53b82cb9b29c2cef3aca961 Mon Sep 17 00:00:00 2001 From: Vitaly Puzrin Date: Wed, 24 Jun 2026 15:21:09 +0300 Subject: [PATCH] Update migration info, close #770 --- docs/migrate_v4_to_v5.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/migrate_v4_to_v5.md b/docs/migrate_v4_to_v5.md index 8c39c256..5cd537e1 100644 --- a/docs/migrate_v4_to_v5.md +++ b/docs/migrate_v4_to_v5.md @@ -39,6 +39,20 @@ CommonJS keeps working through destructuring: const { load, dump } = require('js-yaml') ``` +If you want to keep the old namespace-style calls, import the ESM namespace +instead: + +```js +import * as yaml from 'js-yaml' + +yaml.load(source) +yaml.dump(data) +``` + +js-yaml v5 does not provide an ESM default export by design. Prefer named +exports for new code, or use the namespace import above when migrating code that +expects `yaml.load()` / `yaml.dump()`. + Exports are now flat. The `types` namespace, the `Type` class and `DEFAULT_SCHEMA` are gone, and internal `js-yaml/lib/...` imports no longer resolve. If you used any of those, read on.