Skip to content

Commit

Permalink
build: use next-optimized-images@canary
Browse files Browse the repository at this point in the history
Getting `Error: Input buffer contains unsupported image format`
  • Loading branch information
chadoh committed Feb 1, 2022
1 parent 43cf967 commit f72f0fd
Show file tree
Hide file tree
Showing 6 changed files with 1,093 additions and 3,770 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["next/babel"],
"plugins": ["react-optimized-image/plugin"]
}
16 changes: 4 additions & 12 deletions components/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import Head from "next/head";
import Img from "react-optimized-image";
import Logo from "../public/images/logo.png";
import styles from "../styles/utils.module.css";
import Link from "next/link";

Expand All @@ -22,24 +24,14 @@ export default function Layout({ children, home = false }) {
<header className={styles.header}>
{home ? (
<>
<img
src="/images/logo.png"
height={144}
width={144}
alt=""
/>
<Img src={Logo} height={144} width={144} alt="" />
<h1 className={styles.heading2Xl}>{title}</h1>
</>
) : (
<>
<Link href="/">
<a>
<img
src="/images/logo.png"
height={108}
width={108}
alt=""
/>
<Img src={Logo} height={108} width={108} alt="" />
</a>
</Link>
<h2 className={`${styles.headingLg} ${styles.colorInherit}`}>
Expand Down
6 changes: 6 additions & 0 deletions images.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// see all options: https://github.com/cyrilwanner/next-optimized-images/tree/canary#imagesconfigjs
module.exports = {
default: {
webp: true,
},
};
4 changes: 2 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module.exports = withPlugins([
optimizedImages,
{
/* config for next-optimized-images */
}
]
},
],

// your other plugins here
]);
16 changes: 3 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
"date-fns": "^2.28.0",
"gray-matter": "^4.0.3",
"next": "latest",
"next-compose-plugins": "^2.2.1",
"next-optimized-images": "^2.6.2",
"react": "17.0.2",
"react-dom": "17.0.2",
"remark": "^14.0.2",
Expand All @@ -21,16 +19,8 @@
"@types/react": "^17.0.38",
"eslint": "8.7.0",
"eslint-config-next": "12.0.9",
"image-trace-loader": "^1.0.2",
"imagemin-gifsicle": "^7.0.0",
"imagemin-mozjpeg": "^10.0.0",
"imagemin-optipng": "^8.0.0",
"imagemin-svgo": "^10.0.1",
"jimp": "^0.16.1",
"lqip-loader": "^2.2.1",
"responsive-loader": "^2.3.0",
"svg-sprite-loader": "^6.0.11",
"typescript": "^4.5.5",
"webp-loader": "^0.6.0"
"next-compose-plugins": "^2.2.1",
"next-optimized-images": "^3.0.0-canary.10",
"typescript": "^4.5.5"
}
}

0 comments on commit f72f0fd

Please sign in to comment.