Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add custom function to generate asset manifest #6821

Merged
merged 1 commit into from
Apr 16, 2019

Conversation

iansu
Copy link
Contributor

@iansu iansu commented Apr 14, 2019

Initial work on improving asset manifest. This moves the current output of all files under a files key. This is a breaking change so we want to do this as part of 3.0. This will allow us to add additional information to the manifest under other top-level keys in the future. See #5513.

@iansu
Copy link
Contributor Author

iansu commented Apr 15, 2019

This now generates something like this:

{
  "files": {
    "main.css": "/static/css/main.1a9471a3.chunk.css",
    "main.js": "/static/js/main.28647029.chunk.js",
    "main.js.map": "/static/js/main.28647029.chunk.js.map",
    "runtime~main.js": "/static/js/runtime~main.a8a9905a.js",
    "runtime~main.js.map": "/static/js/runtime~main.a8a9905a.js.map",
    "static/js/2.b41502e9.chunk.js": "/static/js/2.b41502e9.chunk.js",
    "static/js/2.b41502e9.chunk.js.map": "/static/js/2.b41502e9.chunk.js.map",
    "index.html": "/index.html",
    "precache-manifest.ba19183ceb6039c0e3ca4fd52fecfd0b.js": "/precache-manifest.ba19183ceb6039c0e3ca4fd52fecfd0b.js",
    "service-worker.js": "/service-worker.js",
    "static/css/main.1a9471a3.chunk.css.map": "/static/css/main.1a9471a3.chunk.css.map",
    "static/media/logo.svg": "/static/media/logo.5d5d9eef.svg"
  }
}

I named the new top level key files but I'm open to suggestions if anyone has a better idea.

@ianschmitz
Copy link
Contributor

The paths are correct when using PUBLIC_URL I assume?

@iansu
Copy link
Contributor Author

iansu commented Apr 16, 2019

Yes. Building with PUBLIC_URL=http://example.com yarn build produces this output:

{
  "files": {
    "main.css": "http://example.com/static/css/main.1a9471a3.chunk.css",
    "main.js": "http://example.com/static/js/main.230a415d.chunk.js",
    "main.js.map": "http://example.com/static/js/main.230a415d.chunk.js.map",
    "runtime~main.js": "http://example.com/static/js/runtime~main.f7243f3d.js",
    "runtime~main.js.map": "http://example.com/static/js/runtime~main.f7243f3d.js.map",
    "static/js/2.b41502e9.chunk.js": "http://example.com/static/js/2.b41502e9.chunk.js",
    "static/js/2.b41502e9.chunk.js.map": "http://example.com/static/js/2.b41502e9.chunk.js.map",
    "index.html": "http://example.com/index.html",
    "precache-manifest.f3fb1479ad323e31d8e31c3e6e0b140e.js": "http://example.com/precache-manifest.f3fb1479ad323e31d8e31c3e6e0b140e.js",
    "service-worker.js": "http://example.com/service-worker.js",
    "static/css/main.1a9471a3.chunk.css.map": "http://example.com/static/css/main.1a9471a3.chunk.css.map",
    "static/media/logo.svg": "http://example.com/static/media/logo.5d5d9eef.svg"
  }
}

@iansu iansu merged commit 9048dd6 into facebook:master Apr 16, 2019
@lock lock bot locked and limited conversation to collaborators Apr 21, 2019
@iansu iansu deleted the update-asset-manifest branch October 17, 2019 23:31
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants