netlify/netlify-plugin-edge-handlers

Bundles checksum should remain the same when the handler did not change

ehmicky opened this issue · 3 comments

It seems like the bundle's checksum changes even when the Edge handler source code is not changing.
We should provide with consistent checksums instead, as it might help with caching them at some point in the future.

Good point, can we generate a hash from the file contents similar to how webpack does it with output files?

How would this look?

Note: at the moment, we are making a SHA1 digest of the bundle's content.

const buf = Buffer.from(bundle, "utf-8");
const shasum = crypto.createHash("sha1");
shasum.update(buf);
/** @type {import("./upload").BundleInfo} */
const bundleInfo = {
sha: shasum.digest("hex"),

Done at #66.