You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: remove asset prefix warning log and update docs (#68681)
### Why?
In #68622 we fixed a bug that HMR
breaks when `assetPrefix` is set to full URL.
The fix was targeted to the edge case where the user may set `localhost`
to the `assetPrefix`, and technically, when the request is valid the HMR
should work.
However, we do not recommend this pattern as the `assetPrefix` is
intended to be used for setting a CDN URL.
### How?
Therefore we modify the docs to gently imply that the `assetPrefix` is
for CDN URL.
Also, removed the warning log that could be confusing whether we support
it or not.
Setting localhost will still work, but we do not mention about it within
the app.
Copy file name to clipboardExpand all lines: docs/02-app/02-api-reference/05-next-config-js/assetPrefix.mdx
+17-8Lines changed: 17 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -23,16 +23,25 @@ description: Learn how to use the assetPrefix config option to configure your CD
23
23
> suited for hosting your application on a sub-path like `/docs`.
24
24
> We do not suggest you use a custom Asset Prefix for this use case.
25
25
26
-
To set up a [CDN](https://en.wikipedia.org/wiki/Content_delivery_network), you can set up an asset prefix and configure your CDN's origin to resolve to the domain that Next.js is hosted on.
27
-
28
-
Open `next.config.js` and add the `assetPrefix` config:
26
+
## Set up a CDN
29
27
30
-
```js filename="next.config.js"
31
-
constisProd=process.env.NODE_ENV==='production'
28
+
To set up a [CDN](https://en.wikipedia.org/wiki/Content_delivery_network), you can set up an asset prefix and configure your CDN's origin to resolve to the domain that Next.js is hosted on.
32
29
33
-
module.exports= {
34
-
// Use the CDN in production and localhost for development.
0 commit comments