Does Next.js Work in China? Not quite. China has a unique internet ecosystem that most websites - including Next.js websites - don’t work well in by default. The average Next.js website is 3x slower in China than it is elsewhere. Not to mention, the average site has over half of its contents appearing “broken” in China due to inaccessibility or deliverability issues.
Can you make Next.js work in China? Does Next.js work with China CDN? Does hosting websites in China work with Next.js? Let’s find out more below.
Next.js is a popular open-source framework for building web applications in React. It is built on top of React and provides several features that make building scalable, production-ready applications easier.
Some of the key features of Next.js include:
Server-Side Rendering (SSR): Next.js allows you to render your React components on the server side, which can help improve the initial page load speed and SEO of your application.
Automatic Code Splitting: Next.js automatically splits your code into small chunks, which can help improve the performance of your application by reducing the amount of code that needs to be loaded on each page.
Client-Side Routing: Next.js provides a simple and intuitive API for client-side routing, which can help improve the user experience of your application by allowing users to navigate between pages without triggering a full page refresh.
Built-in CSS Support: Next.js comes with built-in support for styling your components using CSS or CSS-in-JS libraries like styled-components or Emotion.
Static Site Generation (SSG): Next.js also supports static site generation, which allows you to pre-render your pages at build time, improving performance and reducing the workload on your server.
Here we take a randomized sample of 50 Next.js websites to generate the following findings.
The average Next.js site takes 33.7+ seconds to load in China
The average Next.js site is only loading 50.32% of web resources in China
In other words, Next.js is failing to deliver over half of its resources in China.
Test websites and page loading time in China using the Chinafy Global Speed Test
When it comes to China, Next.js is not immune to the infrastructural issues and code-based incompatibility issues that most non-China websites face onshore.
Take Hilton’s primary website for example (www.hilton.com) built with Next.js.
The Hilton site usesis 3rd-party services such as Adobe, Google Recaptcha, Facebook that fail to load in China, leading to broken delivery in China (see right).
More about why websites don’t work in China.
Next.js websites can benefit from using a CDN for general website delivery. However, when it comes to China deliverability and performance, CDN content delivery networks only address a portion of the issue.
CDNs are built to optimize resources on the primary domain. Websites consist of both primary and third-party resources. These third-party resources are often the source for performance and functionality issues that visitors face when accessing a site from China.
In short, purely adding on just CDN will not significantly help to address performance issues for Next.js websites in China—if at all.
Hosting websites in China is another option that some companies consider. While viable, doing so is a labor-and time intensive process. Not to mention, a website that is simply rehosted in China will still encounter the third-party resource incompatibility issues outlined above.
Hosting in China requires an onshore business entity, ICP license in China, PBS filing. Not to mention, it is likely you will have to manually rebuild portions, if not the entirety, of the website.
As a separate site, this will also require ongoing maintenance and likely additional headcount.
What is an ICP license in China?
Chinafy is a SaaS-based platform that re-engineers websites and web applications to perform faster, and more functionally for visitors in China.
Chinafy is able to bolt onto an existing website infrastructure to achieve those results -
Without impact on the experience of the site for global visitors
Addition of any software or hardware
Needing to rebuild a site from scratch
When combined with Next.js, developers have a powerful solution for building global applications that can securely and efficiently reach users in China.
When working with Next.js websites, Chinafy's optimization process includes several key steps. First, Chinafy detects and resolves third-party scripts, fonts, or APIs that may be causing slow page load times or other performance issues in China. This is a functionality unique to the Chinafy platform. It is for this unique functionality that tier 1 CDN providers and agencies partner with Chinafy to improve website deliverability in China for their global users.
Finally, Chinafy sets up a fully-managed Content Delivery Network (CDN) near or in in China to help ensure fast and reliable delivery of website content to users in China. This includes files such as images and other static assets.
How Chinafy compares with China CDN such as Fastly, Akamai, Azure, Cloudflare and Alibaba Cloud.
Want a site that works in weeks instead of in months or years? Chinafy might just be the answer for you.
Luxury resort and hotel Group, Banyan Tree, used Chinafy to optimise their Next.js sites in China to load up to 4.5x faster. Read the Chinafy Case Study here.