You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How are you deploying your application? (if relevant)
Static (To be uploaded to S3)
Describe the Bug
Following the direction from the docs, and this article- the export function did not generate the html files for static hosting.
I've tried defining an exportPathMap and setting trailingSlash to true which neither did not change the result.
Expected Behavior
On export the index.html and other defined /pages should be generated into the /out directory. However, only the _next/ directory is created in the /out dir.
Expanded folder shows all files in /out generated from the export command:
To Reproduce
npx create-next-app@latest (currently 12.2.5)
Change 'build' in package.json to next build && next export
Run npm install
Run npm run build
With "exportPathMap" not being defined in next.config.js the command would generate a map from "./pages"
Static HTML files would be available in /out but fails to appear.
The text was updated successfully, but these errors were encountered:
I tried reproducing it and got this error after npm run build, and the resulting directory tree looks like yours.
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.
- Configure `images.unoptimized = true` in `next.config.js` to disable the Image Optimization API.
Read more: https://nextjs.org/docs/messages/export-image-api
After making the experimental fix suggested by the link, it works as expected.
Thanks for helping me out. That'll do it! Perhaps I should be more considerate of the CLI output next time. Adding this to my next.config.js file made it functional for create-next-app:
images: {
unoptimized: true,
},
Further, for my project it worked when wrapped with experimental:
This is covered in the docs here. Currently the static export docs page simply alludes to the setting under Image Optimization using a custom loader, however I would recommend that the documentation team to add a direct reference/step stating that image optimization needs to be disabled for exporting to work.
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Verify canary release
Provide environment information
Which example does this report relate to?
create-next-app
What browser are you using? (if relevant)
N/A
How are you deploying your application? (if relevant)
Static (To be uploaded to S3)
Describe the Bug
Following the direction from the docs, and this article- the export function did not generate the html files for static hosting.
I've tried defining an
exportPathMap
and settingtrailingSlash
to true which neither did not change the result.Expected Behavior
On export the
index.html
and other defined /pages should be generated into the /out directory. However, only the _next/ directory is created in the /out dir.Expanded folder shows all files in /out generated from the export command:
To Reproduce
npx create-next-app@latest
(currently 12.2.5)next build && next export
npm install
npm run build
The text was updated successfully, but these errors were encountered: