NextJS 中的静态 HTML 导出问题

Yog*_*oya 6 reactjs next.js

我是 nextJS 的新手,正在尝试在 html 中部署项目。

Develop your app as you normally do with Next.js. Then run:

next build && next export
For that you may want to update the scripts in your package.json like this:

"scripts": {
  "build": "next build && next export"
}
And run it with:

npm run build
Then you'll have a static version of your app in the out directory.
Run Code Online (Sandbox Code Playgroud)

以上来自https://nextjs.org/docs/advanced-features/static-html-export#how-to-use-it

npm run build它创建的文件夹中,但它只有js文件,index.html文件丢失。

如何以 html 格式导出 nextJS 项目。

谢谢

更新

导出时我收到此错误

Error: Image Optimization using Next.js' default loader is not compatible with `next export`.
  Possible solutions:
    - Use `next start` to run a server, which includes the Image Optimization API.
    - Use any provider which supports Image Optimization (like Vercel).
    - Configure a third-party loader in `next.config.js`.
    - Use the `loader` prop for `next/image`.
  Read more: https://nextjs.org/docs/messages/export-image-api
Run Code Online (Sandbox Code Playgroud)

DMy*_*ich 6

替换Imageimgnpm run build。不支持图像优化next export

\n
<img width={70} height={70} src="https://sun1.beTCOYGm.jpg" alt="\xd0\xbc\xd0\xbe\xd0\xb5 \xd1\x84\xd0\xbe\xd1\x82\xd0\xbe" />\n
Run Code Online (Sandbox Code Playgroud)\n