install-optional
    Preparing search index...

    install-optional

    Install and remove optional dependencies

    import { install, installSync, removeSync } from 'install-optional';

    // removes all optional dependencies with @esbuild/ in their name
    removeSync('esbuild', '@esbuild/');

    // removes all optional dependencies for this platform - sync
    installSync('esbuild', `${process.platform}-${process.arch}`);

    // removes all optional dependencies for this platform - async
    await install('esbuild', `${process.platform}-${process.arch}`)

    API Docs