RFC: next export
back from the dead (or straight to the grave?)
#98
Labels
next export
back from the dead (or straight to the grave?)
#98
Describe the problem you want to solve or enhancement you want to bring
next export
is incompatible with all the cool features of Next.We've been able to keep it around, but for how long? The day might come where we might need to kill this feature...
Define relevant concepts
next export
build your app as a static app => no server at all.getServerSideProps
is not compatible withnext export
*getInitialProps
in_app
is a way to bypass thegetServerSideProps
limitation, and keepnext export
. This hack is however counter productive as you loseAutomatic Static Optimization
: your pages are not built as HTML but as JS, it means a slower rendering. Thanks @clement-faure for pointing this out/my-dashboards/[dashboardId]
are not correctly routed after anext export
if you don't usegetStaticPaths
or if you use the callback. That's because they create a[dashboardId].html
page, but the url will be/my-dashboarsds/1234
=> pointing to1234.html
which doesn't exist. To solve this, you need URL rewriting using a reverse proxy like NGINX. I haven't seen any open source project doing that.The main blocker is i18n: it requires a server to send the right text or to redirect the user based on the language headers.
Describe your solution
1) Best of both worls: next export even in full-stack apps relying on Next server-based feature
For all those features, you need:
getServerSideProps
, warn the user that they should also fetch the data client-side if not present, becausegetServerSideProps
would be ignored. For i18n routing, you need to redirect client-side for example. Or to inject the translations on the fly.2) Keep
next export
aroundThis mostly means not introducing
getServerSideProps
. This would work as long as we make i18n an opt-in feature. Like we could provide all the code, but comment the part that does agetServerSideProps
for example. Or let people set it up based on Next.js documentation.This seems to be Blitz.js choice at the time of writing.
Questions to the community
next export
.The text was updated successfully, but these errors were encountered: