Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[AssetMapper] Better public without digest#50232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[AssetMapper] Better public without digest#50232
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| } | ||
| return$this->extensionsMap[$extension]; | ||
| return$this->extensionsMap[$extension] ??null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
This is unrelated. I had a file that mentioned a sourcemap - sofoo.js.map - and the system exploded because we didn't know the mime type of.map. The mime type is only important for (A) the dev server to return that asset with the correctContent-Type and (B) for asset compilers, if they rely on the mime type. So I think this is a reasonable thing to do.
11641cb to4dbdca0Compare4dbdca0 to54ebd6dComparenicolas-grekas commentedMay 5, 2023
Thank you@weaverryan. |
We have a
MappedAsset::getPublicPathWithoutDigest()method, which would return something like/assets/file2.js. This, sort of odd method, is super useful, for example, when generating the importmap, where we want to communicate to the browser that when it searches for/assets/file2.js(e.g. because insideassets/file1.jsthere is animport './file1.js'), here it should use the digested path - e.g.Anyway, the way that I calculated this originally was a little sketchy. In truth, we have this info very easily in
AssetMapper, so now we pass it in. This also allows an "asset compiler" to figure out which "directory" the final asset will be in, which isn't possible with "public path" as it's still being generated. That little nice detail will be needed in StimulusBundle :).Cheers!