JavaScript npm modules

Import JSON in Node in ESM Modules

Node 16.15 added support for importing JSON modules using the new assert { type: 'json' } syntax.

This is great news if you develop npm modules that need to be consumed both client and server side (or even just server side).

There’s a catch though… As of this writing it is a bit tricky to get working in Jest, and RollupJS just flat-out doesn’t support it (and the import assertions plugin also doesn’t work consistently).