Path conventions belong to the destination. Use an explicit path flavour when generating portable asset names.
Worked example
import path from "node:path";
console.log(path.join("reports", "2026", "summary.json"));Result
reports/2026/summary.jsonImplementation notes
A browser asset path always uses URL syntax. An OS-native separator introduced during a build can create a URL that appears correct on one machine only.
Try it yourself
Compare a filesystem path for Windows with a slash-separated URL path.
Open the JavaScript example →Editorial date November 30, 2026 · Published December 6, 2026