JSON + static export results in twice the size
Unanswered
American Sable posted this in #help-forum
American SableOP
On App router with
output: "export" when I import a JSON from filesystem, it gets loaded as a script tag5 Replies
American SableOP
For example
When I open the HTML file after building, I can see the content inside the
But I also see the content of the json file as a
const HomePage = async () => {
const messages = (await import(`@/messages/fr.json`));
return (
<>
<p>{JSON.stringify(messages)}</p>
</>
);
};When I open the HTML file after building, I can see the content inside the
<p> tag (expected)But I also see the content of the json file as a
<script> before the end of the <body>.<body class="__className_f154f2">
<p>
{"about_page":"About","home_page":"Home"}
</p>
...
<script>
self.__next_f.push([1,':[["$","p",null,{"children":"{\\"about_page\\":\\"About\\",\\"home_page\\":\\"Home\\"}"}],["$","$L1b",null,{}],["$","$L1c",null,{}],"$L1d",["$","$L1e",null,{}]]\n17:null\n',]);
</script>
...
</body>How would I get rid of the <script> content.
Seems that same thing is happening for
metadataAmerican SableOP
Is this expected? If yes what’s the reason?