-
Couldn't load subscription status.
- Fork 29.7k
Open
Labels
Image (next/image)Related to Next.js Image Optimization.Related to Next.js Image Optimization.
Description
Link to the code that reproduces this issue
https://codesandbox.io/p/devbox/p6llq9
To Reproduce
- Install Nextjs 16 with default settings in Windows
npx create-next-app@latest next-app --yes - Create a custom loader for Image, e.g inside
./lib/image.ts, with simple return statement:
import type { ImageLoaderProps } from 'next/image';
export default function ImagePgw({
src,
width,
quality,
}: ImageLoaderProps): string {
return `https://my-custom-image/gw/photo.php?u=${src}&sl=W&fw=${width}&nt=1&q=${quality}`;
}
};
export default nextConfig;- Configure
next.config.ts
import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
images: {
loader: 'custom',
loaderFile: './lib/image.ts',
},
};
export default nextConfig;- Run
npm run dev
Current vs. Expected behavior
With above step recreation, nextjs with turbopack will throw Runtime Error:
Runtime Error
Image with src "/next.svg" is missing "loader" prop.
Read more: https://nextjs.org/docs/messages/next-image-missing-loader
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 11 Pro
Available memory (MB): 32490
Available CPU cores: 16
Binaries:
Node: 20.19.0
npm: 10.8.2
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 16.0.0 // Latest available version is detected (16.0.0).
eslint-config-next: N/A
react: 19.2.0
react-dom: 19.2.0
typescript: 5.9.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Image (next/image)
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
It works well using webpack setup, and also work well on Linux/WSL with turbopack setting, it seems like there is some missing configuration on Windows Env, the above codesandbox work well, but i can't reproduce an example using Windows Env
JessimLr
Metadata
Metadata
Assignees
Labels
Image (next/image)Related to Next.js Image Optimization.Related to Next.js Image Optimization.