-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Description
Feature Request
The Problem
Next.js can't be used for apps running on Smart TV (e.g., on Samsung Tizen platform) or for other client-side rendered apps with dynamic data requirements.
It would be great if Next.js could be used for client-side only apps and still support dynamic routing and automatic code-splitting.
The Solution
SPA Mode
Next.js introduces a mode for building app as a single-page application (SPA). getInitialProps works just like before, but is executed on the client only.
The new option for SPA mode is added to next.config.js:
module.exports = {
…,
spa: true
};Using SPA and SSG
The open question is how to handle both SPA mode and SSG. It looks like it's still possible to do it on a per-page basis (suggested in this RFC). Although there's no clear benefit of using a hybrid app for Smart TV use case as TV apps are hosted locally on the device.
Considered Alternatives
Static export is not an option because the app has dynamic data requirements.
SSR doesn't make sense because the app is hosted locally on the TV device. It's not a technical option either because Node.js isn't available on the TV.
So, the alternative that is left is running the app without Next.js.
Additional context
This RFC mentions the support of "client-side only applications" as one of the goals.
Nuxt.js supports a dedicated mode for building SPA.
Smart TV Apps 101
Smart TV apps are web apps that are executed by TV's browser engine:
- The developer creates an application bundle: styles, scripts, images, index.html, certificates, TV config file, etc.
- The bundle is submitted for review to TV's app store.
- Upon successful review, the app is added to the app store and is available for download.
- The user downloads the app.
- The app is hosted by the TV and is run by the user.
Some Smart TV platforms like webOS TV support hosted web apps, others like Tizen prohibit such kind of apps.