Skip to content

Comments

fix: add .js extensions to all relative imports for ESM compatibility#4

Open
noomorph wants to merge 1 commit intoMonkatraz:masterfrom
noomorph:fix/esm-imports
Open

fix: add .js extensions to all relative imports for ESM compatibility#4
noomorph wants to merge 1 commit intoMonkatraz:masterfrom
noomorph:fix/esm-imports

Conversation

@noomorph
Copy link

@noomorph noomorph commented Oct 6, 2025

Fixes ESM import errors in Node.js (tested on Node 22.17.1 and also Bun 1.2.2) by adding .js extensions to all relative imports.

The library was throwing ERR_MODULE_NOT_FOUND errors when imported as an ES module because Node.js couldn't resolve the module paths without explicit file extensions.

Before:

import { CONSTANTS as C } from "../constants"

After:

import { CONSTANTS as C } from "../constants.js"

Tested with await import('./lib/index.js') - works correctly now.

- Add .js extensions to all relative imports across the codebase
- Fixes ERR_MODULE_NOT_FOUND errors when importing as ES modules
- Enables proper ESM resolution in Node.js environments
- Affects 27 files with 124 insertions and 118 deletions
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