Skip to content

Commit

Permalink
[Script] Updates stale no-script-in-document-page error doc (#37568)
Browse files Browse the repository at this point in the history
[Recent changes](#31936) to `next/script` introduced the capability to use `beforeInteractive` scripts in the custom document. This old error message is incorrect.
  • Loading branch information
housseindjirdeh authored Jun 13, 2022
1 parent 31c8b97 commit 2eb48e7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion errors/no-script-in-document-page.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# Script component inside \_document.js

> ⚠️ This error is not relevant in versions 12.1.6 or later. Please refer to the updated [error message](https://nextjs.org/docs/messages/no-before-interactive-script-outside-document).
#### Why This Error Occurred

You can't use the `next/script` component inside the `_document.js` page. That's because the `_document.js` page only runs on the server and `next/script` has client-side functionality to ensure loading order.
You can't use the `next/script` component inside the `_document.js` page in versions prior to v12.1.6. That's because the `_document.js` page only runs on the server and `next/script` has client-side functionality to ensure loading order.

#### Possible Ways to Fix It

Expand Down

0 comments on commit 2eb48e7

Please sign in to comment.