Skip to content

mix volt.build: --no-sourcemap ignored; empty/CSS-only entries fail with Rolldown source map error #5

@mtarnovan

Description

@mtarnovan

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)

  1. Create a JS entry with only a CSS import:
// assets/pdf/js/pdf.js
import "../css/pdf.css"
  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions