zellij-org/zellij · error

unsupported export form at {}

Error message

unsupported export form at {}

What it means

`export default` and `export *` are hard-rejected by the flattener: a default export has no name to strip and would break the concatenated single-scope bundle, and star re-exports would collide with other modules' top-level declarations.

Source

Thrown at xtask/src/assets.rs:192

                    return Err(anyhow!("unrecognised import syntax at {}", location()));
                }
            }
            if !terminated {
                return Err(anyhow!("unterminated import statement at {}", location()));
            }
            continue;
        }

        if line.starts_with("export ") || line.starts_with("export{") {
            if line.starts_with("export {") {
                if line.contains(" from ") {
                    validate_module_specifier(line, &location())?;
                    continue;
                }
                return Err(anyhow!("unrecognised export syntax at {}", location()));
            }
            if line.starts_with("export default") || line.starts_with("export *") {
                return Err(anyhow!("unsupported export form at {}", location()));
            }
            let stripped = &line["export ".len()..];
            if !DECLARATION_PREFIXES
                .iter()
                .any(|prefix| stripped.starts_with(prefix))
            {
                return Err(anyhow!("unrecognised export syntax at {}", location()));
            }
            out.push_str(stripped);
            out.push('\n');
            continue;
        }

        out.push_str(line);
        out.push('\n');
    }

    Ok(out)

View on GitHub (pinned to 98a0837077)

Solutions

  1. Give the export a name: `export function init() {}`, then update callers to `import { init } from ...`
  2. Replace `export *` with explicit named re-exports: `export { a, b } from './utils.js';`

Example fix

// before (rejected)
export default function init() {}

// after
export function init() {}
Defensive patterns

Strategy: validation

Validate before calling

if grep -nE '^export (default|\*)' zellij-client/assets/*.js; then
  echo 'export default / export * are not supported by the bundler'; exit 1
fi

Type guard

fn is_unsupported_export(line: &str) -> bool {
    line.starts_with("export default") || line.starts_with("export *")
}

Prevention

When it happens

Trigger: Writing `export default function init() {}`, `export default class Widget {}`, or `export * from './utils.js';` in any module under zellij-client/assets.

Common situations: Porting code from npm-style ES modules that use default exports; attempting to create a barrel file that re-exports a whole module.

Related errors


AI-assisted analysis of zellij-org/zellij@98a0837077 (2026-08-16). Data as JSON: /api/errors/ffe87b089601572b. Report an issue: GitHub.