Volt.Pipeline (Volt v0.13.0)

Copy Markdown View Source

Compile source files to browser-ready JavaScript and CSS.

Dispatches to OXC for JS/TS/JSX/TSX and Vize for Vue SFCs and CSS, then runs the shared JavaScript post-processing phase. Framework and plugin output flows through the same post-processing as ordinary source files, so features such as asset URL rewriting, dynamic import variables, import.meta.glob(), import.meta.env, and worker/import specifier rewriting behave consistently.

Summary

Functions

Compile a source file to browser-ready output.

Types

compiled()

@type compiled() :: Volt.Pipeline.Result.t()

rewrite_fn()

@type rewrite_fn() :: (String.t() -> {:rewrite, String.t()} | :keep)

Functions

compile(path, source, opts \\ [])

@spec compile(String.t(), String.t(), keyword()) ::
  {:ok, compiled()} | {:error, term()}

Compile a source file to browser-ready output.

Options

  • :target — downlevel target (e.g. :es2020)
  • :import_source — JSX import source (e.g. "vue")
  • :sourcemap — generate source maps (default: true)
  • :minify — minify output (default: false)
  • :vapor — use Vue Vapor mode (default: false)
  • :rewrite_import — function (specifier -> {:rewrite, new} | :keep) for import rewriting

  • :plugins — list of Volt.Plugin modules to run
  • :define — compile-time replacements for import.meta.env