Closed styxlab closed 3 years ago
Thanks for opening this @styxlab
As I said, I need next export
so that I can host it on an S3 bucket.
Is there any other way to host it on AWS that you are aware of, which doesn't require a next export
?
If you are serving from a static-only host, then next export
is needed, but it is not encouraged as you have to opt out from image optimizations and incremental static regeneration (ISR).
It is already possible to use next export
with the following configuration options:
appConfig.js
:// Images
export const nextFeatureImages: boolean = false
export const nextInlineImages: boolean = false
// Incremental Static Regenerations (ISR)
export const isr: boolean = false
next.config.js
module.exports = withBundleAnalyzer({
...(process.env.NETLIFY === 'true' && { target: 'serverless' }),
images: {
loader: 'imgix',
deviceSizes: [320, 500, 680, 1040, 2080, 2048, 3120],
domains: ['localhost', 'images.unsplash.com', 'static.gotsby.org', 'static.ghost.org'],
},
reactStrictMode: true,
})
The deviceSizes
and domains
props can be deleted or left in. Note that the 'imgix' loader is not used, it must be a Next.js supported loader different from the default loader.
Here is the standard warning from 'Next.js' when using their export
method:
warn - Statically exporting a Next.js application via `next export` disables API routes.
This command is meant for static-only hosts, and is not necessary to make your application static.
Pages in your application without server-side data dependencies will be automatically statically exported by `next build`, including pages powered by `getStaticProps`.
Learn more: https://err.sh/vercel/next.js/api-routes-static-export
@icy-meteor Could you please verify?
Got past the image optimisation error but fails with the following error :
You forgot to disable ISR.
Oops, my bad :) Yes, works now! Confirmed.
Currently, when you run
next export
in this repository, you'll get the following error message:Option 3 should be used to make
next export
available here. Some more investigation is needed on how to make this work.