mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-06 00:37:23 +00:00
AGENTS.md: jsx -> js
This commit is contained in:
1 file changed
+6
-6
@@ -814,19 +814,19 @@ The router includes automatic scroll-to-top functionality and a 404 NotFound pag
|
|||||||
|
|
||||||
### Import Extensions
|
### 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.
|
This is because TypeScript compiles to JavaScript, and the runtime expects the actual file extensions that will exist after compilation.
|
||||||
|
|
||||||
#### Examples
|
#### Examples
|
||||||
|
|
||||||
**✅ Correct imports with .js/.jsx extensions:**
|
**✅ Correct imports with .js extensions:**
|
||||||
```typescript
|
```typescript
|
||||||
// Import TypeScript files with .js extension
|
// Import TypeScript files with .js extension
|
||||||
import { useAuthor } from '@/hooks/useAuthor.js';
|
import { useAuthor } from '@/hooks/useAuthor.js';
|
||||||
import { Button } from '@/components/ui/button.jsx';
|
import { Button } from '@/components/ui/button.js';
|
||||||
import { LoginArea } from "@/components/auth/LoginArea.jsx";
|
import { LoginArea } from "@/components/auth/LoginArea.js";
|
||||||
import AppRouter from "./AppRouter.jsx";
|
import AppRouter from "./AppRouter.js";
|
||||||
import { cn } from '@/lib/utils.js';
|
import { cn } from '@/lib/utils.js';
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -835,7 +835,7 @@ import { cn } from '@/lib/utils.js';
|
|||||||
// These will cause build/runtime errors
|
// These will cause build/runtime errors
|
||||||
import { useAuthor } from '@/hooks/useAuthor';
|
import { useAuthor } from '@/hooks/useAuthor';
|
||||||
import { Button } from '@/components/ui/button.tsx';
|
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 AppRouter from "./AppRouter";
|
||||||
import { cn } from '@/lib/utils.ts';
|
import { cn } from '@/lib/utils.ts';
|
||||||
```
|
```
|
||||||
|
|||||||
Reference in new issue
Block a user