I would like to host my React Project on Amazon S3.
I am developing it with Next.js.
the folder tree is like below this.
pages
|- auth
| |- index.tsx
|- (...)
|- index.tsx
and I did
next build && next export
After building and exporting, I expected it
out
|- _next
|- auth
| |- index.html /* I want another index.html */
|- (...)
|- index.html
|- static
but I got it,
|- _next
|- auth.html /*I need /auth/index.html*/
|- (...)
|- index.html
|- static
How could I achieve it.
Thank you in advance.
https://nextjs.org/docs/api-reference/next.config.js/exportPathMap#adding-a-trailing-slash
Just add exportTrailingSlash: true to next.config.js.
module.exports = {
trailingSlash: true,
}
next.config.js
module.exports = {
exportPathMap: async function (defaultPathMap) {
return {
'/auth/index.html': { page: '/auth' },
};
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With