The data.json file contains a complete manifest of the pages.json file as well as the Redux jsonDataPaths
object that was created at the conclusion of the query execution process. It is lazily imported by async-requires.js, which is leveraged by production-app.js to load the available JSON results for a page. In addition, the data.json file is used during page HTML generation for two purposes:
- The static-entry.js file creates a Webpack bundle (page-renderer.js), which is used to generate the HTML for a given path and requires data.json to search pages for the associated page.
- The data.json file is also used to derive the
jsonName
for a page from an associatedPage
object in order to construct a resource path for the JSON result by searching for it withindata.json.dataPaths[jsonName]
.
The following example illustrates a sample generation of data.json:
{
pages:
[
{
"componentChunkName"
:
"component---src-blog-2-js"
,
"jsonName"
:
"blog-2-c06"
,
"path"
:
"/blog/2"
}
,
//
more
pages
],
//
jsonName
->
dataPath
dataPaths:
{
"blog-2-c06"
:
"952/path---blog-2-c06-meTS6Okzenz0aDEeI6epU4DPJuE"
,
//
more
pages
}
Leave a Reply