/ cypress Public
chore: correctly resolve url sass bundle in Angular CT #25191
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge.
User facing changelog
Angular uses webpack internally. It maps urls in sass via
resolve-url-loader. We need to provide the correct root url - Angular assumes
/by default, but we serve the assets on the dev server on
Known edge case:
.cssfiles doesn't map properly.
.sassdo, though. We could hack it to force
sass-loaderfor css, but that's not really ideal - it's not what their app would be using in prod. In general, to work around it for now, we can just recommend using
.scss- it's in Angular out of the box, and it's a superset of CSS .
This is also an issue for other frameworks (like React) using
scss. Basically, anything using
scssmay exhibit this bug. The problem is more fundamental - I think we are not routing some asset requests properly for CT. I tried tweaking the routing in #25120 but it's too involved right now, and a bit more risky to touch routing, since that impacts the entire of Cypress. This routing issue (at least, I think it's routing) bleeds into other things, too, like this bug: mswjs/msw#744.
I will spend more time thinking about this in the future, but for now I'd like to get Angular working out of the box. Showing images is a pretty basic thing that should work. This PR is the most simple and low risk way to do so.
Steps to test
Grab the repro in the issue from the original user and verify the problem where the images don't show no longer is a problem.
How has the user experience changed?
urlfor images correctly resolves.