@flareapp/vue

中文文档
2.13.0发布于 2026/09/17MITTypeScriptESM + CJS近 30 天下载 2.3万

Vue client for flareapp.io

原始使用文档
文档目录10 节
  1. Installation
  2. Quick start
  3. Logging
  4. Identifying users
  5. Documentation
  6. Component profiling
  7. Self time
  8. Naming with Inertia
  9. Compatibility
  10. License

@flareapp/vue

Vue integration for Flare error tracking and logging. Installs a Vue error handler that catches component errors and reports them to Flare with Vue-specific context (component name, lifecycle info).

Installation

npm install @flareapp/vue @flareapp/js

Quick start

Initialize the Flare client and register the Vue error handler:

import { createApp } from 'vue';
import { flare } from '@flareapp/js';
import { flareVue } from '@flareapp/vue';

import App from './App.vue';

flare.light('YOUR_FLARE_API_KEY');

const app = createApp(App);

flareVue(app);

app.mount('#app');

Logging

Beyond errors, the client can send structured logs. Logs are opt-in: enable them with enableLogs, then call any of the eight syslog levels (debug, info, notice, warning, error, critical, alert, emergency).

import { flare } from '@flareapp/js';

flare.configure({ enableLogs: true });

flare.logger.info('Checkout started', { cartId: cart.id, total: cart.total });

Identifying users

import { flare } from '@flareapp/js';

flare.setUser({ id: 123, email: '[email protected]', fullName: 'Jane Doe' });

See the JavaScript identifying-users docs for the full field list. Pass null to clear.

Documentation

Full documentation on the Vue error handler and its options is available at flareapp.io/docs/vue/general/installation.

Component profiling

Record a span per component mount, nested under the active page-load or navigation trace. Requires tracing (enableTracing: true) and an allowlist:

app.use(flareVue, {
    router,
    profileComponents: ['ProductPage', 'CartPage', /^Checkout/],
});

app.use(flareVue, …) and flare.configure({ enableTracing: true }) can run in either order. Installing the plugin first is fine: the router guards and the profiler hook stay idle until tracing is on.

Strings match the component name exactly. Regular expressions match by test(). true profiles every named component, which is useful when exploring but will hit the 1024 span per trace cap on a real page and bury the spans you care about.

Names come from the same resolution the error reports use: the name the SFC compiler derives from the filename, then an explicit name option, then AnonymousComponent. Renaming a component silently stops profiling it.

Only mounts are recorded. Updates, <KeepAlive> reactivation and unmounts are not.

A component that mounts later inside an already-mounted profiled ancestor still nests under that ancestor, whose own span closed when it finished mounting. The tree is correct, but the waterfall shows the child starting after its parent ended. A page body swapped inside a persistent layout is the usual way to see this.

Async components and <Suspense>: Vue treats a component as mounted once its synchronous children are mounted. A component with an async setup(), or one inside a <Suspense> boundary, therefore mounts after its profiled ancestor's span has closed, so it appears after its parent in the waterfall. If the whole trace closed by then, the span is dropped rather than attached to a finished trace.

Self time

Every component span carries flare.component.self_time_ns: the span's duration minus the time its own profiled children account for. Children that overlap in time are counted once, so the value never goes below zero.

A child that mounts after its parent's span closed is not subtracted. Its work happened outside the parent's window, so the parent keeps its full duration.

A layout is the usual example. vue-router resolves the first route after the layout mounted, so the page component's work falls outside the layout's window.

Naming with Inertia

Inertia names navigation spans after the page component from its page object, so a root reads Products/Show. Vue names components after the file, so ./Pages/Products/Show.vue is Show, and ./Pages/Orders/Show.vue is also Show. Set the name explicitly on page components if you want the two to read the same:

<script setup>
defineOptions({ name: 'Products/Show' });
</script>

Without it, spans use the bare filename, which is usually still readable because the root span disambiguates.

Compatibility

  • Vue 3

License

The MIT License (MIT). Please see License File for more information.

版本与发布记录

@flareapp/vue 共发布 28 个版本,首次发布于 2024/01/25;过去 12 个月发布了 20 个版本。

版本发布日期距今
2.13.0latest2026/09/171 个月前
2.12.22026/09/142 个月前
2.12.12026/09/112 个月前
2.12.02026/09/022 个月前
2.11.02026/08/272 个月前
2.10.02026/08/262 个月前

关于 @flareapp/vue 的常见问题

@flareapp/vue 是什么?

Vue client for flareapp.io

如何安装 @flareapp/vue?

在项目目录运行 npm install @flareapp/vue,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:vue(^3.0.0)、@flareapp/js(^2.13.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@flareapp/vue 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@flareapp/vue 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@flareapp/vue 可以商用吗?

@flareapp/vue 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@flareapp/vue 的下载量有多少?

根据 npm 官方下载统计,@flareapp/vue 在 2026/10/15 – 2026/11/13 这 30 天内被下载 23,215 次,日均约 774 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@flareapp/vue 还在维护吗?

最新版本 2.13.0 发布于 2026/09/17(1 个月前);至今共发布 28 个版本,其中过去 12 个月发布了 20 个;首次发布于 2024/01/25。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。