playcanvas / playcanvas/engine

Why is getFileUrl not adding hashes for script assets?

Open
#5,136 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area: scripts requires: discussion
Dominant language
JavaScript
Stars
16.8k
Forks
2k
Avg merge
4h 32m
Merged PRs (30d)
222

Description

Line: https://github.com/playcanvas/engine/blob/main/src/framework/asset/asset.js#L385

This means that scripts won't cache bust like other assets and is causing some issues on CDNs with clients projects.

This code was added about 6 years ago

As a workaround, we've given the clients an engine patch for this function: https://playcanvas.com/project/1047700/overview/asset-fileurl-patch

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/framework/asset/asset.js#L385 and inspect how getFileUrl handles script assets versus other asset types. Reproduce or trace the generated script URL, then verify that the URL includes the expected hash for CDN cache busting. The workaround link provides context for the intended behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
performance, web-dev
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.