Add "entrypoints" key to asset manifest #7721
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem:
We would like to generate the
index.html
file on the server. In order to get code splitting to work, we need to know which chunks are entrypoints of the React app (to be able to request these from the HTML file). Unfortunately, this currently doesn't seem to be possible (see #5225 (comment)).Ideally,
splitChunks.name
would simply be set totrue
in the Webpack config, so the entrypoints could be inferred from the file names. However, this seems to lead to caching issues (see #5030 (comment)).This PR implements @iansu's suggestion from #5513 (comment): It adds an additional
"entrypoints"
key to theasset-manifest.json
file with the names of the files that need to be included in the generated HTML.Before:
After:
Note: This PR is a draft because it requires shellscape/webpack-manifest-plugin#192 to be merged into
webpack-manifest-plugin
first. Without that change, the information about the order in which the assets need to be included isn't available yet (see #5513 (comment)).Closes #5513