mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
## Summary Adds deployment ID suffix (`?dpl=<deployment_id>`) to asset URLs referenced in CSS `url()` declarations (images, fonts) for both Turbopack and Webpack builds. This enables proper cache busting for CSS-referenced assets when using `deploymentId` in `next.config.js`. ### Turbopack - Added `static_suffix` field to the existing `UrlBehavior` struct, providing a build-time constant suffix for contexts that cannot use dynamic JS expressions (e.g., CSS `url()` references) - CSS URL resolution now calls `url_behavior(None)` and uses `static_suffix` instead of a separate method - Wired the suffix from `next.config.js` `deploymentId` through `asset_suffix_path()` into all three chunking contexts (client, server, edge) via `default_url_behavior` and `url_behavior_override` ### Webpack - Passed `deploymentId` through the CSS loader config pipeline (`webpack-config.ts` → `config/index.ts` → `css/loaders/` → `postcss-url-parser.ts`) - Appended `?dpl=<id>` to resolved asset URLs in the PostCSS URL parser plugin, placed before any hash fragment so it remains a server-visible query parameter ### Test - Added production test (`test/production/css-url-deployment-id/`) covering global CSS, CSS modules, and SCSS modules with image and font `url()` references - Verifies all asset URLs contain the `dpl` query parameter in both Turbopack and Webpack modes
9 lines
160 B
SCSS
9 lines
160 B
SCSS
.scssWithImage {
|
|
background-image: url('./test-image.png');
|
|
}
|
|
|
|
@font-face {
|
|
font-family: 'TestFontScss';
|
|
src: url('./test-font.woff2') format('woff2');
|
|
}
|