mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
93a9e97c71
Closes: https://linear.app/vercel/issue/DOC-4604/public-folder - Renames "Static Assets" page to "Public Folder" and moves it to the file-system conventions section. Redirects: https://github.com/vercel/front/pull/44623
39 lines
937 B
Plaintext
39 lines
937 B
Plaintext
---
|
|
title: Static directory is deprecated
|
|
---
|
|
|
|
## Why This Error Occurred
|
|
|
|
In versions prior to 9.0.6 the `static` directory was used to serve static assets in a Next.js application. This has been deprecated in favor of a `public` directory.
|
|
|
|
The reason we want to support a `public` directory instead is to not require the `/static` prefix for assets anymore and there is no reason to maintain both paths.
|
|
|
|
## Possible Ways to Fix It
|
|
|
|
You can move your `static` directory inside of the `public` directory and all URLs will stay the same as they were before.
|
|
|
|
**Before**
|
|
|
|
```txt
|
|
.
|
|
├── pages/
|
|
│ └── index.js
|
|
└── static/
|
|
└── my-image.jpg
|
|
```
|
|
|
|
**After**
|
|
|
|
```txt
|
|
.
|
|
├── pages/
|
|
│ └── index.js
|
|
└── public/
|
|
└── static/
|
|
└── my-image.jpg
|
|
```
|
|
|
|
## Useful Links
|
|
|
|
- [Static file serving docs](/docs/pages/api-reference/file-conventions/public-folder)
|