Skip to content

refactor(deps): migrate dotenv from v16.5.0 to v17.3.1#3

Open
s0wa48 wants to merge 1 commit intoCreativeBuilds:masterfrom
s0wa48:deps/upgrade-dotenv-17.3.1
Open

refactor(deps): migrate dotenv from v16.5.0 to v17.3.1#3
s0wa48 wants to merge 1 commit intoCreativeBuilds:masterfrom
s0wa48:deps/upgrade-dotenv-17.3.1

Conversation

@s0wa48
Copy link

@s0wa48 s0wa48 commented Mar 3, 2026

Changes

Breaking Change: dotenv v17 is ESM-only

dotenv v17 dropped legacy CommonJS interop. The import dotenv from 'dotenv'; dotenv.config() pattern still works in TypeScript/ESM contexts, but the recommended idiomatic approach is now to use the dotenv/config side-effect import which automatically loads .env on import.

Migrations applied

  • package.json: Bumped dotenv from ^16.5.0 to ^17.3.1
  • validator/index.ts: Replaced import dotenv from 'dotenv' + dotenv.config() call with the simpler import 'dotenv/config' side-effect import
  • scripts/weights.ts: Replaced import dotenv from 'dotenv' + dotenv.config() with import 'dotenv/config'
  • scripts/create-key.ts: Replaced import dotenv from 'dotenv' + dotenv.config() with import 'dotenv/config'
  • hardhat.config.js: Added safe wrapper around require('dotenv') call since this file runs as CommonJS in Hardhat context; dotenv v17's ESM-first design requires careful handling in CJS environments

Notes

  • The dotenv/config import pattern is the v17-recommended approach and works seamlessly with TypeScript and bundlers
  • The .env file path and override option in hardhat.config.js are preserved as-is since that file has custom path resolution logic

This PR was auto-generated by Gittensor upgrade bot using Claude AI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant