-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Replace asset references in CSS returned to JS #5729
Conversation
Would you add a test case for #5599 in one of the playgrounds so we avoid future regressions? |
Sure, any pointers where to add it and how as it needs to use the production/built version? |
6bffbfd
to
74045a5
Compare
Ok, I think I figured it out. Now there is a test but what's up with the quotes? In my real project, I get |
Well, now it deals with all possible quoting |
Cannot find it currently, but in one of the PRs we introduce a util function |
Seems like the approach here is wrong as it doesn't associate assets with chunks as shown by other tests. I am starting to think that this is actually ONLY a quoting issue In the
At the end of
However when it gets to
and thus the regexp trying to find |
aha, there is a
to
|
I might understand just a little bit better now how the code works... There are two cases: URLs added in JS
URLs added through CSS imported in JS
In the JS case, the code is like
and in the CSS import case it is like (because CSS is run through a minifier)
In both cases, it seems like proper quoting should already be in place and it is fine to only replace the placeholders |
Just to be clear: This should now be done. Old and new test pass |
Thanks for the fix, and adding the test 🙌 |
Description
Replace
__VITE__ASSET__XYZ
in CSS when imported into JSFixes #5599
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).