When vite builds bundles for production it postfixes a random identifier to the end of the bundle name.
When we publish bundles to npm that use the main
property package.json
to indicate the bundle file ( So that the UNPKG CDN can be used) we have to update this property each time we want to publish.
Does vite have a way to hook into the build with a callback function that that can be run to update the main
property with the new bundle file name?
It's possible to just make the bundle name fixed, but that has some drawbacks as discussed here.