Page MenuHomePhabricator

ResourceLoader: Implement source map support for package files
Open, MediumPublic


This is a more specific and pressing issue than T47514, which can worked avoided by using debug=true.

Even in debug mode, package files get concatenated and served from a load.php URL with a version hash that changes the URL every time the file is modified. This means that even once you've got to the source code using the convoluted method described in, all your breakpoints will be lost once you make a change.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Esanders updated the task description. (Show Details)

a version hash that changes the URL every time the file is modified

We could work around this by dropping the version param whenever packageFiles and debug mode are used. Raw files in debug mode don't get a version param, so this would be making the behaviour match that.

Raw files in debug mode don't get a version param [..]

Can you elaborate? I agree we should make breakpoints easy and sticky, but as I understand it, urls change with classic file modules and debug mode as well. E.g. loads, etc.

Interesting, that seems like a bug. Possibly configuration related.

I don't have a preference for whether these urls have version parameters. However, note that their current presence in debug mode is not due to some generic code applying there. Rather, it was intentionally added to solve the problem outlined in T90983: ResourceLoader debug urls should bypass cache when they change. If we remove these, we'll have to re-solve that in a different way.

In a nut shell:

  • Static files from wgResourceBasePath are expected to have long-caching headers set at the web server level (depending on complexity of a dev setup, this is entirely optional, but it is something we do need to support in prod, in beta and when testing with MW-Vagrant with the Varnish module enabled).
  • In production we have multiple versions deployed at once from a single docroot, which means we need to disambiguate which version the current URL is for in a way that doesn't vary by hostname (all /w/resources and /static urls are cached in Varnish with host-agnostic cache key) . This applies mainly to font files and SVG icons.
  • Given raw debug files are served from the same directory, we need to cache-bust them, as well as to disambiguate. Using a content address/ hash param, solved both.

Moving to T235672. This task is just about source map support

Krinkle triaged this task as Medium priority.Oct 23 2019, 7:50 PM
Krinkle moved this task from Inbox to Accepted Enhancement on the MediaWiki-ResourceLoader board.
Krinkle moved this task from Inbox to Backlog: Future Goals on the Performance-Team board.