wrangler: disable adding hash to static files

having a issue with wrangler adding hash on already processed static files such as client.1d7f9682.js -> client.1d7f9682.b897097c67.js. is there a way to tell wrangler to not generate hash for static files? wrangler deploy ./dist/_worker.js --compatibility-date 2023-05-24 --name test --site dist/_astro/
1 Reply
Kai
Kai•13mo ago
https://github.dev/cloudflare/workers-sdk/blob/main/packages/wrangler/src/sites.ts
const assetKey = hashAsset(hasher, assetFile, content);
validateAssetKey(assetKey);

if (!namespaceKeys.has(assetKey)) {
logDiff(
chalk.green(` + ${assetKey} (uploading new version of ${assetFile})`)
);

// Check if adding this asset to the bucket would push it over the KV
// bulk API limits
if (
uploadBucketSize + assetSize > MAX_BUCKET_SIZE ||
uploadBucket.length + 1 > MAX_BUCKET_KEYS
) {
// If so, record the current bucket and reset it
uploadBuckets.push(uploadBucket);
uploadBucketSize = 0;
uploadBucket = [];
}

// Update the bucket and the size counter
uploadBucketSize += assetSize;
uploadBucket.push([absAssetFile, assetKey]);
uploadCount++;
} else {
logDiff(chalk.dim(` = ${assetKey} (already uploaded ${assetFile})`));
skipCount++;
}

// Remove the key from the set so we know what we've already uploaded
namespaceKeys.delete(assetKey);

// Prevent different manifest keys on windows
const manifestKey = urlSafe(path.relative(assetDirectory, absAssetFile));
manifest[manifestKey] = assetKey;
}
const assetKey = hashAsset(hasher, assetFile, content);
validateAssetKey(assetKey);

if (!namespaceKeys.has(assetKey)) {
logDiff(
chalk.green(` + ${assetKey} (uploading new version of ${assetFile})`)
);

// Check if adding this asset to the bucket would push it over the KV
// bulk API limits
if (
uploadBucketSize + assetSize > MAX_BUCKET_SIZE ||
uploadBucket.length + 1 > MAX_BUCKET_KEYS
) {
// If so, record the current bucket and reset it
uploadBuckets.push(uploadBucket);
uploadBucketSize = 0;
uploadBucket = [];
}

// Update the bucket and the size counter
uploadBucketSize += assetSize;
uploadBucket.push([absAssetFile, assetKey]);
uploadCount++;
} else {
logDiff(chalk.dim(` = ${assetKey} (already uploaded ${assetFile})`));
skipCount++;
}

// Remove the key from the set so we know what we've already uploaded
namespaceKeys.delete(assetKey);

// Prevent different manifest keys on windows
const manifestKey = urlSafe(path.relative(assetDirectory, absAssetFile));
manifest[manifestKey] = assetKey;
}
😦