diff --git a/AGENTS.md b/AGENTS.md index 792c140..6cfb41d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -814,19 +814,19 @@ The router includes automatic scroll-to-top functionality and a 404 NotFound pag ### Import Extensions -This project uses ES modules with Node.js-style module resolution (`"type": "module"` and `"moduleResolution": "nodenext"`). **All imports MUST include explicit file extensions**, and specifically **`.js`/`.jsx` extensions must be used** even when importing TypeScript files. +This project uses ES modules with Node.js-style module resolution (`"type": "module"` and `"moduleResolution": "nodenext"`). **All imports MUST include explicit file extensions**, and specifically **`.js` extensions must be used** even when importing TypeScript files. This is because TypeScript compiles to JavaScript, and the runtime expects the actual file extensions that will exist after compilation. #### Examples -**✅ Correct imports with .js/.jsx extensions:** +**✅ Correct imports with .js extensions:** ```typescript // Import TypeScript files with .js extension import { useAuthor } from '@/hooks/useAuthor.js'; -import { Button } from '@/components/ui/button.jsx'; -import { LoginArea } from "@/components/auth/LoginArea.jsx"; -import AppRouter from "./AppRouter.jsx"; +import { Button } from '@/components/ui/button.js'; +import { LoginArea } from "@/components/auth/LoginArea.js"; +import AppRouter from "./AppRouter.js"; import { cn } from '@/lib/utils.js'; ``` @@ -835,7 +835,7 @@ import { cn } from '@/lib/utils.js'; // These will cause build/runtime errors import { useAuthor } from '@/hooks/useAuthor'; import { Button } from '@/components/ui/button.tsx'; -import { LoginArea } from "@/components/auth/LoginArea"; +import { LoginArea } from "@/components/auth/LoginArea.jsx"; import AppRouter from "./AppRouter"; import { cn } from '@/lib/utils.ts'; ```