Load __NEXT_DATA__ without using inline javascript for ISR
Unanswered
Bahama Swallow posted this in #help-forum
Bahama SwallowOP
Hello everyone,
I've been working on a Next.js project where we use Incremental Static Regeneration (ISR) to improve our site's performance and SEO. However, I'm looking for a way to load NEXT_DATA without relying on inline JavaScript.
Here are the details of my setup:
Current Configuration: Standard ISR setup as per the Next.js documentation
What I want to achieve:
Eliminate the use of inline JavaScript for injecting NEXT_DATA.
Ensure the NEXT_DATA is still available for hydration and proper functioning of the ISR.
Questions:
Is it possible to load NEXT_DATA externally rather than embedding it directly in the HTML?
If yes, what changes would be required in the Next.js configuration or the ISR setup to achieve this?
Are there any potential downsides or performance implications of loading NEXT_DATA externally?
Has anyone implemented a similar solution, and if so, what were your experiences and challenges?
Additional information
Next.js Version: 14.x
Deployment Platform: SST / AWS
I've been working on a Next.js project where we use Incremental Static Regeneration (ISR) to improve our site's performance and SEO. However, I'm looking for a way to load NEXT_DATA without relying on inline JavaScript.
Here are the details of my setup:
Current Configuration: Standard ISR setup as per the Next.js documentation
What I want to achieve:
Eliminate the use of inline JavaScript for injecting NEXT_DATA.
Ensure the NEXT_DATA is still available for hydration and proper functioning of the ISR.
Questions:
Is it possible to load NEXT_DATA externally rather than embedding it directly in the HTML?
If yes, what changes would be required in the Next.js configuration or the ISR setup to achieve this?
Are there any potential downsides or performance implications of loading NEXT_DATA externally?
Has anyone implemented a similar solution, and if so, what were your experiences and challenges?
Additional information
Next.js Version: 14.x
Deployment Platform: SST / AWS
1 Reply
nope i dont think it is possible.
if you use the app router, you won't have
__NEXT_DATA__ is a core part of the pages router.if you use the app router, you won't have
__NEXT_DATA__ but you will still have inline scripts. can't avoid 'em.