Conversation
|
Ideally the test would test with a .css file too, someone has ideas how to get vite to not bundle-up all css? There is a small chance for differences w rollup if someone were to set a custom sanitizer in rollup options, but that sits in the danger zone, so this fix is still better than leaving asset names unsanitized. |
benmccann
left a comment
There was a problem hiding this comment.
thanks for figuring this out!!
|
Needs an additional test for collision resilience |
|
Collisions are no problem as long as asset hashing isn't turned off. If one would do that, |
|
with asset hashing disabled, I think that is still acceptable because not sanitizing asset filenames at all is a larger risk/problem. |
|
|
||
| case '[name]': | ||
| return name | ||
| return sanitizeFileName(name) |
There was a problem hiding this comment.
Shouldn't we use output.sanitizeFileName here to support custom functions by the user? (and also avoid the need to replicate the default in our code)
https://rollupjs.org/guide/en/#outputsanitizefilename
There was a problem hiding this comment.
Discussing with @dominikg in Vite Land, we don't have access to Rollup's default. We can also leave support for custom sanitize functions for another PR. I think we can merge this PR and then work on extending support later.
Description
Vite supplies a custom assetFileName to rollup, which means that rollup itself won't sanitize it further.
This PR copies the default sanitize function from rollup and applies it to the name.
fixes sveltejs/kit#5843
Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123).