Uh oh!
There was an error while loading. Please reload this page.
Add "entrypoints" key to asset manifest - #7721
Merged
Merged
Conversation
iansu
commented
Sep 23, 2019
Contributor
This is great. Thanks for putting this together. I think we can merge this as soon as the PR in |
samuelmeuli
marked this pull request as ready for review
September 24, 2019 07:14
samuelmeuli
requested review from
ianschmitz, iansu, mrmckeb and petetnt
as code ownersSeptember 24, 2019 07:14
samuelmeuli
commented
Sep 24, 2019
ContributorAuthor
The author has already merged it. I've updated the required package version. |
iansu
commented
Sep 24, 2019
Contributor
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.htmlfile 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.namewould simply be set totruein 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.jsonfile with the names of the files that need to be included in the generated HTML.Before:
{ "files": { "main.css": "/static/css/main.2cce8147.chunk.css", "main.js": "/static/js/main.fd729682.chunk.js", "main.js.map": "/static/js/main.fd729682.chunk.js.map", "runtime-main.js": "/static/js/runtime-main.f7c36e2a.js", "runtime-main.js.map": "/static/js/runtime-main.f7c36e2a.js.map", "static/js/2.ae086021.chunk.js": "/static/js/2.ae086021.chunk.js", "static/js/2.ae086021.chunk.js.map": "/static/js/2.ae086021.chunk.js.map", "index.html": "/index.html", "precache-manifest.be4e4fdd4a55417b6c618c280ec25a62.js": "/precache-manifest.be4e4fdd4a55417b6c618c280ec25a62.js", "service-worker.js": "/service-worker.js", "static/css/main.2cce8147.chunk.css.map": "/static/css/main.2cce8147.chunk.css.map", "static/media/logo.svg": "/static/media/logo.5d5d9eef.svg" } }After:
{ "files": { "main.css": "/static/css/main.b100e6da.chunk.css", "main.js": "/static/js/main.70abf459.chunk.js", "main.js.map": "/static/js/main.70abf459.chunk.js.map", "runtime-main.js": "/static/js/runtime-main.fdecdd6f.js", "runtime-main.js.map": "/static/js/runtime-main.fdecdd6f.js.map", "static/js/2.a3ab821d.chunk.js": "/static/js/2.a3ab821d.chunk.js", "static/js/2.a3ab821d.chunk.js.map": "/static/js/2.a3ab821d.chunk.js.map", "index.html": "/index.html", "precache-manifest.47b41692c7614ae757144cfe8f04d3cb.js": "/precache-manifest.47b41692c7614ae757144cfe8f04d3cb.js", "service-worker.js": "/service-worker.js", "static/css/main.b100e6da.chunk.css.map": "/static/css/main.b100e6da.chunk.css.map", "static/media/logo.svg": "/static/media/logo.25bf045c.svg" }, "entrypoints": [ "static/js/runtime-main.fdecdd6f.js", "static/js/2.a3ab821d.chunk.js", "static/css/main.b100e6da.chunk.css", "static/js/main.70abf459.chunk.js" ] }Note: This PR is a draft because it requires shellscape/webpack-manifest-plugin#192 to be merged into
webpack-manifest-pluginfirst. 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