Skip to content

Commit

Permalink
fix(image-loader): handle development mode local image loading (#1150)
Browse files Browse the repository at this point in the history
  • Loading branch information
enapupe authored Jun 7, 2024
1 parent fdb64aa commit 8b6f8df
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/app/(default)/about/components/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ const Values: React.FC = () => (
src={mapHero}
alt='Picture of a map'
width={400}
unoptimized
/>
</div>
<div className='absolute bottom-0 left-24'>
Expand Down
4 changes: 4 additions & 0 deletions src/image-loader.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
'use client'
const dev = process.env.NODE_ENV !== 'production'
const imageLoader = ({ src, width, quality }) => {
if (dev && src.startsWith('/_next')) {
return src
}
return `${process.env.NEXT_PUBLIC_CDN_URL}${src}?w=${width}&q=${quality || 75}`
}

Expand Down

0 comments on commit 8b6f8df

Please sign in to comment.