Skip to content

Commit 1cf0a53

Browse files
authored
fix: loadFile ignore ts extend on readFileSync (#294)
eggjs/tegg#283 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Updated the file loading functionality to properly differentiate TypeScript files from other file types. This modification prevents unintended processing behavior for TypeScript content, ensuring more reliable file operations and enhancing overall stability in handling various file formats. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 799d37f commit 1cf0a53

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/utils/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default {
7878
try {
7979
// if not js module, just return content buffer
8080
const extname = path.extname(filepath);
81-
if (extname && !extensionNames.includes(extname)) {
81+
if (extname && !extensionNames.includes(extname) && extname !== '.ts') {
8282
return fs.readFileSync(filepath);
8383
}
8484
const obj = await importModule(filepath, { importDefaultOnly: true });

0 commit comments

Comments
 (0)