Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@lencioni
Copy link
Contributor

@lencioni lencioni commented Dec 5, 2025

If people are using an older version of Node.js, it will fail to import files with some extensions, such as .ts or .mts. The error message is not very helpful, it just says it is an unknown file extension. I'm hoping we can help people out a little here by providing a more useful error message.

If people are using an older version of Node.js, it will fail to import
files with some extensions, such as .ts or .mts. The error message is
not very helpful, it just says it is an unknown file extension. I'm
hoping we can help people out a little here by providing a more useful
error message.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances error messaging when users attempt to use config file extensions that aren't supported by their current Node.js version. Instead of showing a generic "unknown file extension" error, users now receive a helpful message directing them to upgrade Node.js to a version with native TypeScript support.

Key Changes:

  • Added try-catch block around config file import to catch ERR_UNKNOWN_FILE_EXTENSION errors
  • Throws a descriptive TypeError with specific Node.js version recommendations when unsupported extensions are detected
  • Added test coverage for the new error handling behavior

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/config/loadConfig.ts Wraps config import in try-catch to detect unsupported file extensions and throws helpful error message with Node.js version guidance
src/config/tests/loadConfig.test.ts Adds test case verifying the improved error message when loading config files with unsupported extensions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lencioni lencioni merged commit 2da25e5 into main Dec 5, 2025
19 checks passed
@lencioni lencioni deleted the unsupported-ext branch December 5, 2025 17:19
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.

2 participants