P113の話、
ch03/next-sample
のnpm run build
で、
> next-sample@0.1.0 build > next build info - SWC minify release candidate enabled. https://nextjs.link/swcmin Failed to compile. ./pages/api/hello.ts 8:1 Warning: Assign arrow function to a variable before exporting as module default import/no-anonymous-default-export ./pages/image-sample.tsx 12:7 Warning: Do not use `<img>` element. Use `<Image />` from `next/image` instead. See: https://nextjs.org/docs/messages/no-img-element @next/next/no-img-element 12:7 Warning: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text 16:7 Warning: Image elements must have an alt prop, either with meaningful text, or an empty string for decorative images. jsx-a11y/alt-text ./pages/link.tsx 39:6 Warning: React Hook useEffect has a missing dependency: 'router.events'. Either include it or remove the dependency array. react-hooks/exhaustive-deps 47:35 Error: `"` can be escaped with `"`, `“`, `"`, `”`. react/no-unescaped-entities 47:40 Error: `"` can be escaped with `"`, `“`, `"`, `”`. react/no-unescaped-entities 54:35 Error: `"` can be escaped with `"`, `“`, `"`, `”`. react/no-unescaped-entities 54:41 Error: `"` can be escaped with `"`, `“`, `"`, `”`. react/no-unescaped-entities
この変なエラー。
react/no-unescaped-entities
ルールの仕業?
.eslintrc.json
ってファイルの
{ "extends": "next/core-web-vitals" }
って書いてるのを
"rules": { "react/no-unescaped-entities": 0 }
追加する。
つまり
{ "extends": "next/core-web-vitals", "rules": { "react/no-unescaped-entities": 0 } }
カンマ忘れず。
これでnpm run build
行けた。