How Well Does Azure Static Web Apps (SWA) Support Next.js? | Pages Architecture
I have developed an application that focuses on isolating and testing the most essential features of Next.js. After creating the app, I deployed it to Azure Static Web Apps (SWA). Recently, SWA updated its platform, and I was excited to see how their improvements have impacted Next.js. To my surprise, the improvements were impressive.
š” The current app uses the Pages-based architecture; I plan to develop an App Router Next.js application very soon. Give the repo a ā.
Next.js Application Overview
The Next.js application I deployed is publicly available and open-source on GitHub at https://github.com/thomas-desmond/host-check-nextjs.
Essential factors of the app:
- Next.js version 13.4.16
- Pages-based Architecture
- Sitecore JSS version 21.6.3
For more details on the app, check out my earlier article: Exploring Every Feature in Next.js and Testing Hosting Providers or YouTube Video: Using Every Next.js Feature to Test Hosting Providers (Part 1).
How I Deployed the Next.js Application
I followed the Deploy hybrid Next.js websites on Azure Static Web Apps (Preview) documentation to deploy my app. I didn't make any configuration changes, so it was an out-of-the-box deployment of Next.js to Azure Static Web Apps.
Although Next.js support has been in preview on Azure SWA for years, this latest release makes me expect it to be out of preview soon. However, I am not hosting production Next.js applications in SWA since support is still in preview.
Next.js Support in Azure Static Web Apps
I was presently surprised that Azure Static Webs Apps had full support for every feature I tested. I ran my automated Cypress tests against the deployed Next.js app, and every test passed.
Check out the table to see every feature tested and the results.
Based on the test results, Azure Static Web Apps is a suitable platform to host a Pages-based Next.js application on version 13. However, it's important to note that SWA Next.js support is still in preview, so it's not recommended for production deployments yet.Ā
I tested a pages-based Next.js 14 app, which failed due to Node version issues. I haven't investigated further, but Node 14 deployments do not work out of the box for now.
How to Test Hosting Providers Yourself
Want to test Azure Static Web Apps for yourself? Have a specific version of Next.js that you need to test.
- Fork my open-source repository on GitHub: https://github.com/thomas-desmond/host-check-nextjs
- Remember to give the repo a star! ā
- Deploy the Next.js to your hosting provider
- Change the
url
environment variable in thecypress.config.ts
file - Run the automated Cypress end-to-end tests and see the results
- Open cypress test window
npm run cypress:open
- Choose E2E Tests
- Choose your preferred browser
- Run all the specs (tests)
- Review the results of the tests
- Open cypress test window