chore: update migration docs for next/image #5326
Merged
AlemTuzlakmerged 1 commit into
main fromrefs/pull/5326/head·merged by schiller-manuel(GitHub profile, opens in a new tab) Showing 1 changed file with 23 additions and 0 deletions.
x
23 additions and 0 deletions+23-0docs/start/framework/react/migrate-from-next-js.mdModifiedView file
@@ -304,6 +304,29 @@
+### Images
+
+Next.js uses the `next/image` component for optimized images. In TanStack Start, you can use the package called [Unpic](https://unpic.pics/) for similar functionality
+and almost a drop-in replacement.
+
+```tsx
+import Image from "next/image" // [!code --]
+import { Image } from "@unpic/react"; // [!code ++]
+function Component() {
+ return (
+ <Image
+ src="/path/to/image.jpg"
+ alt="Description"
+ width="600" // [!code --]
+ height="400" // [!code --]
+ width={600} // [!code ++]
+ height={400} // [!code ++]
+ />
+ )
+}
Thread on lines 309 to 326
⚠️ Potential issue | 🟠 Major
Add install step for Unpic before showing usage.
The new snippet imports @unpic/react, but we never tell readers to install it. Following the guide as written will crash at build time with “Cannot resolve module '@unpic/react'.” Please insert an install command (e.g. npm install @unpic/react) in this section before the code sample so the migration instructions are complete.
### Images
Next.js uses the `next/image` component for optimized images. In TanStack Start, you can use the package called [Unpic](https://unpic.pics/) for similar functionality
and almost a drop-in replacement.
+Install the React component:
+
+```sh
+npm install @unpic/react
+```
+
```tsx
import Image from "next/image" // [!code --]
import { Image } from "@unpic/react"; // [!code ++]
🤖 Prompt for AI Agents
In docs/start/framework/react/migrate-from-next-js.md around lines 309 to 326,
the example imports @unpic/react but never tells readers to install it; add an
install step immediately before the code block (e.g., a short sentence and the
npm install @unpic/react command, with equivalent yarn/pnpm examples if you
prefer) so users can install the package before trying the snippet and avoid the
“Cannot resolve module '@unpic/react'” build error.