Summary
When bundling an entry that emits effectively empty JS (for example, a JS entry that only imports CSS), mix volt.build fails with:
Build failed: [%{message: "Rolldown did not produce a source map"}]
Also, --no-sourcemap currently does not disable sourcemaps, so this failure is hard to avoid unless using --sourcemap false explicitly.
Environment
volt 0.8.2
oxc 0.10.0 (via volt deps)
- Elixir 1.19.4 / OTP 28
- macOS Darwin 25.4.0
Repro (Volt)
- Create a JS entry with only a CSS import:
// assets/pdf/js/pdf.js
import "../css/pdf.css"
- Run:
mix volt.build --entry assets/pdf/js/pdf.js --outdir priv/static/pdf/assets --target es2025 --resolve-dir deps --no-hash --no-minify --no-sourcemap
Actual
Build failed: [%{message: "Rolldown did not produce a source map"}]
Expected
--no-sourcemap should disable sourcemap generation and the build should succeed.
Additional findings
--sourcemap false works as a workaround:
mix volt.build --entry assets/pdf/js/pdf.js --outdir priv/static/pdf/assets --target es2025 --resolve-dir deps --no-hash --no-minify --sourcemap false
--no-sourcemap appears to be ignored in Mix.Tasks.Volt.Build because :sourcemap is parsed as :string; OptionParser treats --no-sourcemap as invalid and it is dropped.
Quick proof:
elixir -e 'IO.inspect OptionParser.parse(["--no-sourcemap"], strict: [sourcemap: :string])'
# => {[], [], [{"--no-sourcemap", nil}]}
- There also seems to be an upstream edge case in
oxc sourcemap handling for empty output:
mix run -e 'files=[{"main.js", ""}]; IO.inspect(OXC.bundle(files, entry: "main.js", sourcemap: true, format: :iife))'
# => {:error, [%{message: "Rolldown did not produce a source map"}]}
That suggests chunk.map can be absent for empty bundles, and the current wrapper turns that into a hard error.
Happy to open a separate oxc issue too if useful.
Summary
When bundling an entry that emits effectively empty JS (for example, a JS entry that only imports CSS),
mix volt.buildfails with:Also,
--no-sourcemapcurrently does not disable sourcemaps, so this failure is hard to avoid unless using--sourcemap falseexplicitly.Environment
volt0.8.2oxc0.10.0 (viavoltdeps)Repro (Volt)
Actual
Build failed: [%{message: "Rolldown did not produce a source map"}]Expected
--no-sourcemapshould disable sourcemap generation and the build should succeed.Additional findings
--sourcemap falseworks as a workaround:mix volt.build --entry assets/pdf/js/pdf.js --outdir priv/static/pdf/assets --target es2025 --resolve-dir deps --no-hash --no-minify --sourcemap false--no-sourcemapappears to be ignored inMix.Tasks.Volt.Buildbecause:sourcemapis parsed as:string; OptionParser treats--no-sourcemapas invalid and it is dropped.Quick proof:
oxcsourcemap handling for empty output:That suggests
chunk.mapcan be absent for empty bundles, and the current wrapper turns that into a hard error.Happy to open a separate
oxcissue too if useful.