Skip to content
Merged
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
14 changes: 14 additions & 0 deletions docs/migrate_v4_to_v5.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down