We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f1e45cd commit 89024c4Copy full SHA for 89024c4
1 file changed
docs/migrate_v4_to_v5.md
@@ -39,6 +39,20 @@ CommonJS keeps working through destructuring:
39
const { load, dump } = require('js-yaml')
40
```
41
42
+If you want to keep the old namespace-style calls, import the ESM namespace
43
+instead:
44
+
45
+```js
46
+import * as yaml from 'js-yaml'
47
48
+yaml.load(source)
49
+yaml.dump(data)
50
+```
51
52
+js-yaml v5 does not provide an ESM default export by design. Prefer named
53
+exports for new code, or use the namespace import above when migrating code that
54
+expects `yaml.load()` / `yaml.dump()`.
55
56
Exports are now flat. The `types` namespace, the `Type` class and
57
`DEFAULT_SCHEMA` are gone, and internal `js-yaml/lib/...` imports no longer
58
resolve. If you used any of those, read on.
0 commit comments