Skip to content

fix: Rewrite relative url() paths when inlining @StyleSheet imports in production bundle (#24165) (CP: 25.1)#24200

Merged
vaadin-bot merged 1 commit into25.1from
cherry-pick-24165-to-25.1-1777029969725
Apr 24, 2026
Merged

fix: Rewrite relative url() paths when inlining @StyleSheet imports in production bundle (#24165) (CP: 25.1)#24200
vaadin-bot merged 1 commit into25.1from
cherry-pick-24165-to-25.1-1777029969725

Conversation

@vaadin-bot
Copy link
Copy Markdown
Collaborator

This PR cherry-picks changes from the original PR #24165 to branch 25.1.

Original PR description

When a CSS file referenced by @Stylesheet contains @import statements that pull in other CSS files with relative url(...) references, the production build inlined the imports but left the urls untouched. After inlining, the browser resolves those urls relative to the entry file, breaking image paths.

Add a new build-time entry point that rewrites url(...) references so each one is expressed relative to the entry CSS file's folder. Absolute urls, protocol urls (http, https, data, ftp, file) and urls whose resolved target falls outside the entry's base folder (e.g. npm package siblings) are left untouched.

Fixes #24164

…n production bundle (#24165)

When a CSS file referenced by @Stylesheet contains @import statements
that pull in other CSS files with relative url(...) references, the
production build inlined the imports but left the urls untouched. After
inlining, the browser resolves those urls relative to the entry file,
breaking image paths.

Add a new build-time entry point that rewrites url(...) references so
each one is expressed relative to the entry CSS file's folder. Absolute
urls, protocol urls (http, https, data, ftp, file) and urls whose
resolved target falls outside the entry's base folder (e.g. npm package
siblings) are left untouched.

Fixes #24164
@vaadin-bot
Copy link
Copy Markdown
Collaborator Author

This PR is eligible for auto-merging policy, so it has been approved automatically. If there are pending conditions, auto merge (with 'squash' method) has been enabled for this PR [Message is sent from bot]

@vaadin-bot vaadin-bot enabled auto-merge (squash) April 24, 2026 11:35
@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown

Test Results

 1 387 files  ± 0   1 387 suites  ±0   1h 18m 9s ⏱️ +36s
10 013 tests +12   9 943 ✅ +12  70 💤 ±0  0 ❌ ±0 
10 486 runs  +12  10 407 ✅ +12  79 💤 ±0  0 ❌ ±0 

Results for commit dca5075. ± Comparison against base commit 3dc4b93.

@vaadin-bot vaadin-bot merged commit 7e99adb into 25.1 Apr 24, 2026
29 checks passed
@vaadin-bot vaadin-bot deleted the cherry-pick-24165-to-25.1-1777029969725 branch April 24, 2026 11:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants