require_optional

Allows you declare optionalPeerDependencies that can be satisfied by the top level module but ignored if they are not.

Usage no npm install needed!

<script type="module">
  import requireOptional from 'https://cdn.skypack.dev/require_optional';
</script>

README

require_optional

Work around the problem that we do not have a optionalPeerDependencies concept in node.js making it a hassle to optionally include native modules