Skip to content

Conversation

harshrox
Copy link

@harshrox harshrox commented Apr 2, 2025

Issue

The assert keyword used in JSON imports does not work with Node.js v22, causing an import error as shown in the image below.
Screenshot from 2025-04-02 20-53-33

We could have used the "with" statement instead of assert, which works in Node.js v22, but it is not supported in older Node.js versions. This would have led to compatibility issues across different versions.

Fix

Replaced all assert { type: "json" } imports with fs.readFileSync()-based JSON parsing. This method ensures compatibility with all Node.js versions, as it relies on fs.readFileSync() instead of import assertions.

Screenshot after the fix:
Screenshot from 2025-04-02 20-54-55

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