Merge pull request #977 from abernier/patch-1

`process.env.BASE_PATH` doc
This commit is contained in:
Timothy 2024-07-30 16:53:45 +08:00 committed by GitHub
commit 1a32fb7781
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -301,6 +301,8 @@ Then, deploy the generated `out` folder or run `npx serve out` it locally.
> ```sh
> $ EXPORT=1 UNOPTIMIZED=1 BASE_PATH=/myblog yarn build
> ```
>
> => In your code, `${process.env.BASE_PATH || ''}/robots.txt` will print `"/myblog/robots.txt"` in the `out` build (or only `/robots.txt` if `yarn dev`, ie: on localhost:3000)
> [!TIP]
> Alternatively to `UNOPTIMIZED=1`, to continue using `next/image`, you can use an alternative image optimization provider such as Imgix, Cloudinary or Akamai. See [image optimization documentation](https://nextjs.org/docs/app/building-your-application/deploying/static-exports#image-optimization) for more details.