-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] ImageComponent does not work when combine trailingSlash
and basePath
#36681
Comments
could temporary resolve the problem by adding following to file next.config.js
|
Looks like the order of these two if statements needs to be flipped: next.js/packages/next/server/config.ts Lines 398 to 410 in 1f68a5d
|
Yep. After patching the file images are now working. Thanks @styfle |
The issue is still happening with See the reproduction here: |
That's actually not the problem with the It stops working in case of custom |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify canary release
Provide environment information
What browser are you using? (if relevant)
Microsoft Edge Version 101.0.1210.32 (Official build) (arm64)
How are you deploying your application? (if relevant)
next start
Describe the Bug
When we combine
basePath
withtrailingSlash
, thenext/image
component does not applies the correctsrc
andsrcSet
.It always generates
/_next/...
instead/<base-path>/_next/...
.That leads to images not loading properly.
Expected Behavior
Add the
basePath
into the generatedsrc
andsrcSets
so the image can be loaded properly.To Reproduce
npm install
npm run dev
http://localhost:3001/docs/
If you run
npm build && npm start
, the image will still be broken.The text was updated successfully, but these errors were encountered: