Next.js 13.1 introduces improvements to the app directory, built-in module transpilation, stable edge runtime for API Routes, and many improvements to Turbopack support.
Next.js 13.1 includes improvements to both the pages/ (stable) and app/ (beta) directories:
In Next.js 13, we announced the new app directory (beta). This new routing and data fetching system can be incrementally adopted alongside your existing pages directory.
The app directory provides many benefits, including enhanced layouts, co-location of components, tests, and styles, component-level data fetching, and more. Thanks to your feedback and early testing, we've made several improvements to the reliability of the app directory:
We're excited about continuing to make progress on the stability of the app directory. The beta documentation for the app directory has had hundreds of updates based on your feedback .
You can now mark dependencies from local packages (like monorepos) or from…
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.
Next.js 13.1 includes improvements to both the pages/ (stable) and app/ (beta) directories:
How It Works
Many popular npm packages make use of "barrel files" to provide a single file that re-exports other modules. For example: export { default as Button } from './dist/Button';
export { default as Slider } from './dist/Slider';
export { default as Dropdown } from './dist/Dropdown';
This allows consumers of the package to use named exports in a single line: import { Button, Slider, Dropdown } from '@acme/ui';
While bundlers understand these barrel fil
Implementation / Getting Started
In Next.js 13, we announced the new app directory (beta). This new routing and data fetching system can be incrementally adopted alongside your existing pages directory. The app directory provides many benefits, including enhanced layouts, co-location of components, tests, and styles, component-level data fetching, and more. Thanks to your feedback and early testing, we've made several improvements to the reliability of the app directory: We're e
General
Thanks to your feedback, we're making Next.js Middleware more powerful than ever. With 13.1, you can now return responses from Middleware, as well as set headers on the request. These API improvements give you powerful new flexibility to customize every part of the Next.js routing lifecycle. The experimental.allowMiddlewareResponseBody configuration option inside next.config.js is no longer required. You can now more easily set headers on the req
General
You can now mark dependencies from local packages (like monorepos) or from external dependencies (node_modules) to be transpiled and bundled. This built-in support replaces the popular next-transpile-modules package. /** @type {import('next').NextConfig} */
const nextConfig = {
transpilePackages: ['@acme/ui', 'lodash-es'],
};
module.exports = nextConfig;
We are thankful to Pierre de la Martinière
(@martpie) for their work on this package and