Package
optional-require
NodeJS Require that let you handle module not found error without try/catch
Key numbers
As of 25 Sept 2026
- Weekly downloads
- 624.6k
- -1% over 12 months
- Gzip bundle size
- -
- No Bundlephobia data
- Dependencies
- 0
- Direct, from package.json
- Last release
- 25 days ago
- v2.1.1
- GitHub stars
- 9
- 5 forks
- Open issues / PRs
- 3 / 0
- Contributors
- -
- Commits, last 52 weeks
- 4
Downloads
Last week 2026-09-15 to 2026-09-21
624,602 downloads last week. The 12-month change of -1% compares the average of the last 4 weeks with the first 4 weeks of the series.
- Releases, last 12 months
- 126 in total
- Latest version
- 2.1.1, 30 Aug 202625 days ago
- First published
- 4 Feb 2017
- Last push to GitHub
- 30 Aug 202625 days before the snapshot
- Repository archived
- No
- Open issues
- 3
- Open pull requests
- 0
- Commits, last 52 weeks
- 4
- Dependents on npm
- -
Major versions
- v2 first release 2.0.0, 31 May 2025
- v1 first release 1.0.0, 4 Feb 2017
- v0 first release 0.1.0, 4 Feb 2017
Recent releases
| Version | Published |
|---|---|
| 2.1.1 | 30 Aug 2026 |
| 2.1.0 | 6 Jul 2025 |
| 2.0.4 | 1 Jul 2025 |
| 1.1.10 | 1 Jul 2025 |
| 2.0.3 | 1 Jul 2025 |
| 1.1.9 | 1 Jul 2025 |
| 2.0.2 | 1 Jul 2025 |
| 2.0.1 | 3 Jun 2025 |
| 2.0.0 | 31 May 2025 |
| 1.1.8 | 22 Sept 2021 |
| 1.1.7 | 12 Aug 2021 |
| 1.1.6 | 7 Aug 2021 |
| 1.1.5 | 7 Aug 2021 |
| 1.1.4 | 5 Aug 2021 |
- Module format
- ESM + CommonJSFrom package.json type, main and exports fields
- TypeScript types
- Bundled
- Node.js engine range
- >=20
- Runtimes
- -
- Unpacked size (npm)
- 66 kB
- Dependencies (0)
- None
npm install optional-require- jsDelivr
https://cdn.jsdelivr.net/npm/optional-require@2.1.1/ - unpkg
https://unpkg.com/optional-require@2.1.1/ - esm.sh
https://esm.sh/optional-require@2.1.1
Indexability: Indexed.