oxc-project/oxc · error · OxcDiagnostic

Missing default export.

Error message

Missing default export.

What it means

Emitted by run_once of the vue require-default-export rule when a .vue file (or script block) contains no default export at all. It is a structural guard: Vue SFC tooling expects the component to be the module's default export, and its absence breaks consumption of the file.

Source

Thrown at crates/oxc_linter/src/rules/vue/require_default_export.rs:13

use oxc_ast::{AstKind, ast::Expression};
use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;

use crate::{
    context::{ContextHost, LintContext},
    frameworks::FrameworkOptions,
    rule::Rule,
};

fn missing_default_export_diagnostic(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Missing default export.").with_label(span)
}

fn must_be_default_export_diagnostic(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Component must be the default export.").with_label(span)
}

#[derive(Debug, Default, Clone)]
pub struct RequireDefaultExport;

declare_oxc_lint!(
    /// ### What it does
    ///
    /// Require components to be the default export.
    ///
    /// ### Why is this bad?
    ///
    /// Using SFCs (Single File Components) without a default export is
    /// not supported in Vue 3. Components should be exported as the default export.

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Add a default export for the component, e.g. export default defineComponent({ ... }) or a top-level <script setup> block
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/vue/require_default_export.rs:13 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20). Data as JSON: /api/errors/487d4175fc417e86. Report an issue: GitHub.