Back to Prettier

18611

changelog_unreleased/javascript/18611.md

3.9.0919 B
Original Source

Drop support for the old "import assertions" syntax (#18611 by @fisker)

import assertions (using the assert keyword) is an old version of the current import attributes proposal.

js
// Old (deprecated)
import foo from "./foo.json" assert { type: "json" };

// Current standard
import foo from "./foo.json" with { type: "json" };

Babel 8 completely removed support for the legacy assert syntax (the old parser plugin is gone). Without Babel parser support, Prettier can no longer reliably parse or format code using import ... assert { ... }.

Please migrate to the with syntax.

diff
- import foo from "./foo.json" assert { type: "json" };
+ import foo from "./foo.json" with   { type: "json" };

See also Prettier's disclaimer about non-standard syntax.