modernize to ESM with Node.js 18+ and TypeScript support
BREAKING CHANGE: This release modernizes the package to current standards and introduces several breaking changes:
- Minimum Node.js version is now 18.0.0 (previously 12+)
- Package is now ESM-only, CommonJS (
require()) is no longer supported - All imports must use ESM syntax (
importinstead ofrequire) - CLI preload flag changed from
-rto--import - Converted entire codebase from CommonJS to ES Modules
New features:
- Full TypeScript support with included .d.ts files (no build step required)
- Comprehensive JSDoc type annotations for better IDE support
- Modern package exports for better import resolution
- Updated dependencies to latest versions (dotenv ^16.4.7, jest ^29.7.0, standard ^17.1.2)
- GitHub Actions workflow updated to test Node 18, 20, and 22
Migration guide included in MIGRATION.md for users upgrading from v2.x.
Users must update their code from:
require('dotenv-defaults/config')To:
import 'dotenv-defaults/config'See MIGRATION.md for complete upgrade instructions.