Summary
OXC.bundle/2 currently returns an error when sourcemap: true and Rolldown does not attach a map (e.g. empty or effectively-empty bundle output):
{:error, [%{message: "Rolldown did not produce a source map"}]}
This bubbles up to Volt builds and can fail otherwise-valid builds.
Environment
oxc 0.10.0
- Elixir 1.19.4 / OTP 28
- macOS Darwin 25.4.0
Minimal Repro
mix run -e 'files=[{"main.js", ""}]; IO.inspect(OXC.bundle(files, entry: "main.js", sourcemap: true, format: :iife))'
Actual
{:error, [%{message: "Rolldown did not produce a source map"}]}
Expected
One of:
- Return success with
sourcemap: nil / omitted map for this edge case, or
- Handle this case in a non-fatal way so callers can still receive generated code.
Additional context
Sourcemap disabled works as expected:
mix run -e 'files=[{"main.js", ""}]; IO.inspect(OXC.bundle(files, entry: "main.js", sourcemap: false, format: :iife))'
# => {:ok, "(function() {\n\n\n})();"}
Potential throw site appears in native/oxc_ex_nif/src/bundle.rs:
let sourcemap_json = chunk
.map
.as_ref()
.map(oxc_sourcemap::SourceMap::to_json_string)
.ok_or_else(|| vec!["Rolldown did not produce a source map".to_string()])?;
Happy to test any proposed patch quickly.
Summary
OXC.bundle/2currently returns an error whensourcemap: trueand Rolldown does not attach a map (e.g. empty or effectively-empty bundle output):This bubbles up to Volt builds and can fail otherwise-valid builds.
Environment
oxc0.10.0Minimal Repro
mix run -e 'files=[{"main.js", ""}]; IO.inspect(OXC.bundle(files, entry: "main.js", sourcemap: true, format: :iife))'Actual
Expected
One of:
sourcemap: nil/ omitted map for this edge case, orAdditional context
Sourcemap disabled works as expected:
Potential throw site appears in
native/oxc_ex_nif/src/bundle.rs:Happy to test any proposed patch quickly.