Next.js 9.1 leverages convention to support more project structures by default. Additionally, we're previewing new feature support such as CSS imports, advanced bundling, and static error pages.
Today, we are excited to announce Next.js 9.1 with src and public directory support.
As always, we strive to ensure all of these benefits are backward compatible. All you need to do to update is run:
If your application is on a version of Next.js before 9 you can reference the upgrade guide for changes you may need to upgrade.
Since our last major release, we are happy to have seen companies like TikTok , Hilton , Elastic , Realtor , and JW Player launch with Next.js. Check out the showcase for more!
Next.js has a special pages directory where every file becomes a separate route, following the convention over configuration approach this directory is required to be in the…
This is an excerpt. The full article is published by Next.js Blog.
Answers to common questions regarding this article's topic, architecture, and practical applications.
Besides the pages directory Next.js has one other special directory called static, files of which were mapped to the /static route. For example, static/my-image.png would be mapped to /static/my-image.png. This convention has worked out well ever since the first release of Next.js and doesn't have problems in particular. However, over time we have established that /static doesn't cover everything needed in a web application. For example, robots.t
General
Today, we are excited to announce Next.js 9.1 with src and public directory support.
How It Works
Next.js has a special pages directory where every file becomes a separate route, following the convention over configuration approach this directory is required to be in the root of a Next.js application. In talking with companies using Next.js and inspecting some closed source codebases we established a common pattern developers wanted is to have a src directory for their code and have the pages directory within it also. Starting from Next.js 9.
General
As shared in the Next.js 9 announcement the Google Chrome team is investing resources into improving Next.js and has been working on multiple efforts to make large-scale performance improvements for all Next.js applications. To learn more about this collaboration you can read the Next.js 9 announcement and watch this talk by Nicole Sullivan at React Rally.
General
Currently, Next.js has a CSS-in-JS solution built-in called styled-jsx. This solution works well for styling individual React components. However, when talking to companies we found there is a common need to reuse some existing styling or design system based around CSS. In general, this means adding in the next-css plugin to add CSS imports support. We found that around 50% of all Next.js users add this plugin to their application. Because of thi