Compatibility with broccoli-asset-rev functionality (asset fingerprinting, assetMap.json manifest)
See original GitHub issueIn the past it was mentioned that Embroider eliminates the need for broccoli-asset-rev
:
https://github.com/ember-cli/broccoli-asset-rev/issues/65#issuecomment-535089537
Perhaps I’ve lost something along the way with our embroider configuration but it seems like broccoli-asset-rev
still fills two roles in our deploy pipeline:
- Static asset revisioning + rewriting (bitmaps, svgs, mp3s, etc.)
- Asset manifest production (
dist/assetMap.json
)
Static asset revisioning
Is there any way to replicate the behaviour of static assets (eg. in public/
) getting checksum filenames?
Asset manifest production (assetMap.json)
The latter is somewhat more trivial and, with a little manual work, can be statically generated from the files on disk post-build but I’m wondering if Embroider considers this a first-class feature.
In our apps we often don’t use the index.html
generated by the build process but rather generate the html server-side ourselves, injecting the correct script tags referencing the latest bundle revision. With this setup we rely on the assetMap.json
generated by broccoli-asset-rev
to allow us to look up the right asset (mapping development build filenames to production asset filenames, eg. appname.js
→ appname-1A2B3C.js
).
To try reach feature parity with this in Embroider land, we configure webpack to limit the initial bundle count to 1 and give it a special name (eg. appname.[chunkhash].js
, such that it’s distinguishable from the runtime chunks pulled in by @embroider/router). This works nicely and we can even use a webpack plugin to generate a similar asset manifest but this doesn’t work for the vendor bundles as they’re synthesised outside of webpack.
Is this asset manifest still a useful concept with Embroider and if so could it warrant being emitted as a build artefact? (Even as an opt-in)
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (3 by maintainers)
Top GitHub Comments
We are working on a standardized solution here: https://github.com/emberjs/rfcs/pull/763
It is still not really clear to me (as somebody who is not really experienced with Webpack, which I guess probably applies to a lot of Ember devs) how I am supposed to migrate my existing, previously auto-fingerprinted code to Embroider/Webpack.
It would be great if there would be a kind of “how to” documentation in how to do that - maybe somebody who knows how these things work can help out there? Some concrete examples:
That used to be fingerprinted, but now aren’t. So if I update the image without changing the file name, it will not be reflected.
The JSON files also used to be auto-fingerprinted (when adding .json to the fingerprint extensions), which also doesn’t happen anymore either.
I’m happy to update some configuration or do some manual stuff, but I honestly don’t really know where to start 😬