broken css url when used "asset" rule type
Open
Nobody has claimed this yet.
CSS
- Dominant language
- JavaScript
- Stars
- 142k
- Forks
- 32.4k
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 351
Description
Link to the code that reproduces this issue
To Reproduce
npm installnpm run dev- Go to http://localhost:3000
- enable/disable rule for svg inside next.config.ts to see bug
// app/style.css
.bg{
// should correct load image
background: url("./img.svg");
}
Current vs. Expected behavior
Expected behavior
.bg {
background: url("../media/img.8569dc29.svg");
}
Current behavior
.bg {
background: url("./img.svg");
}
without rule for svg it works correct
Provide environment information
Operating System:
Platform: linux
Arch: x64
Version: #1 SMP PREEMPT_DYNAMIC Sun Aug 6 20:05:33 UTC 2023
Available memory (MB): 4102
Available CPU cores: 2
Binaries:
Node: 20.12.1
npm: 10.5.0
Yarn: 1.22.19
pnpm: 8.15.6
Relevant Packages:
next: 16.2.0-canary.35 // Latest available version is detected (16.2.0-canary.35).
eslint-config-next: N/A
react: 19.2.4
react-dom: 19.2.4
typescript: 5.9.3
Next.js Config:
output: N/A
Which area(s) are affected? (Select all that apply)
CSS
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
Related PR
https://github.com/vercel/next.js/pull/88788
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the CodeSandbox reproduction and inspect next.config.ts, app/style.css, and the SVG asset referenced there. Compare development output with and without the SVG asset rule, then review the related PR for existing context. Done means the CSS URL is rewritten to the emitted hashed asset path when the rule is enabled.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, next.js
- Domain
- build-system, frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100