The sync-requires.js file is a dynamically created JavaScript file that exports individual Gatsby components, generated by iterating over the Redux components
namespace. In these exports, the keys represent the componentChunk
name (e.g., component—src-blog-2-js), and values represent expressions requiring the component (e.g., require("/home/site/src/blog/2.js")
), to yield a result like the following:
exports.components
=
{
"component---src--blog-2-js":
require("/home/site/src/blog/2.js"),
// more components
}
This file is employed during the execution of static-entry.js to map each component’s componentChunkName
to its respective component implementation. Because production-app.js (covered in “Bundling Gatsby”) performs code splitting, it needs to use async-requires.js instead.
Leave a Reply