parcel-bundler / parcel-bundler/lightningcss
Wrong urls after bundling
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 7.7k
- Forks
- 302
- PR merge metrics
- No merged PRs in 30d
Description
Hello, there is an issue relative to urls when parcel bundle css files together.
Urls found in files that gets bundled should be updated somehow because the following happens for now:
elements.css
@import "./fire/fire.css";
@import "./water/water.css";
fire/fire.css
.fire {
background: url("./logo.png");
}
water/water.css
.water {
background: url("./logo.png");
}
Actual output generated by parcel
.fire, .water {
background: url(./logo.png);
}
Expected output
.fire {
background: url(./fire/logo.png);
}
.water{
background: url(./water/logo.png);
}
Code used to run parcel css bundler
import { createRequire } from "node:module"
import { fileURLToPath } from "node:url"
const require = createRequire(import.meta.url)
const { bundle } = require("@parcel/css")
const { code } = await bundle({
filename: fileURLToPath(new URL("./elements.css", import.meta.url)),
minify: false,
})
console.log(String(code))
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
Run the provided @parcel/css bundle example with elements.css and the fire/water stylesheet structure to reproduce the incorrect URLs. Trace how CSS @import and url() paths are handled during bundling; done means the generated CSS preserves fire/logo.png and water/logo.png as separate relative paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, rust
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100