oxc-project/oxc · error · OxcDiagnostic

Use imports from `vue` instead of `@vue/*`.

Error message

Use imports from `vue` instead of `@vue/*`.

What it means

Emitted by run_once of the vue prefer-import-from-vue rule when it finds an import statement referencing a @vue/* scoped package (e.g. @vue/reactivity). These internals are almost always meant to be imported from the single vue entry point instead, so the guard flags the scoped specifier.

Source

Thrown at crates/oxc_linter/src/rules/vue/prefer_import_from_vue.rs:8

use oxc_diagnostics::OxcDiagnostic;
use oxc_macros::declare_oxc_lint;
use oxc_span::Span;

use crate::{context::LintContext, rule::Rule};

fn prefer_import_from_vue_diagnostic(span: Span) -> OxcDiagnostic {
    OxcDiagnostic::warn("Use imports from `vue` instead of `@vue/*`.").with_label(span)
}

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

declare_oxc_lint!(
    /// ### What it does
    ///
    /// Enforce imports from `vue` instead of `@vue/*`.
    ///
    /// ### Why is this bad?
    ///
    /// Imports from the following modules are almost always wrong. You should import from vue instead.
    /// - `@vue/runtime-dom`
    /// - `@vue/runtime-core`
    /// - `@vue/reactivity`
    /// - `@vue/shared`
    ///

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Change the import source from @vue/* to vue, e.g. import { ref } from 'vue'
  2. If you truly need internals, disable the rule for that line with an inline comment
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/oxc_linter/src/rules/vue/prefer_import_from_vue.rs:8 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/7a427d8218dabe73. Report an issue: GitHub.