Vue

The @domscribe/vue package provides Vue 3 VNode resolution, Composition API and Options API support, and bundler plugins for Vite and Webpack.

Install

npm install -D @domscribe/vue

Vite Setup

// vite.config.ts
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { domscribe } from '@domscribe/vue/vite';

export default defineConfig({
  plugins: [vue(), domscribe()],
});

Webpack Setup

Webpack requires both a loader (for AST transformation) and a plugin (for relay and overlay coordination):

// webpack.config.js
const { DomscribeWebpackPlugin } = require('@domscribe/vue/webpack');

const isDevelopment = process.env.NODE_ENV !== 'production';

module.exports = {
  module: {
    rules: [
      {
        test: /\.[jt]sx?$/,
        exclude: /node_modules/,
        enforce: 'pre',
        use: [
          {
            loader: '@domscribe/transform/webpack-loader',
            options: { enabled: isDevelopment },
          },
        ],
      },
    ],
  },
  plugins: [
    new DomscribeWebpackPlugin({
      enabled: isDevelopment,
      overlay: true,
    }),
  ],
};

Supported Versions

Plugin Options

The Vue plugin extends the base transform options with runtime and capture namespaces:

domscribe({
  // Base transform options
  include: /\.(jsx|tsx|vue)$/,
  exclude: /node_modules/,
  debug: false,
  relay: { autoStart: true, port: 0, host: '127.0.0.1' },
  overlay: true,

  // Vue-specific
  runtime: { /* ... */ },
  capture: { /* ... */ },
})

Runtime Options

OptionTypeDefaultDescription
phase1 | 21Feature phase gate. Phase 1: props/state. Phase 2: events/perf.
redactPIIbooleantrueRedact sensitive values in captured data.
blockSelectorsstring[][]CSS selectors to exclude from capture.

Capture Options

OptionTypeDefaultDescription
maxTreeDepthnumber50Maximum component tree depth to traverse.

How It Works

The Vue adapter accesses component instances via the __vueParentComponent property that Vue 3 attaches to DOM elements. From each component instance, it extracts:

Both Composition API and Options API components are fully supported. The adapter detects the component style automatically and extracts data accordingly.

Adapter Options

The underlying VueAdapter accepts these options:

OptionTypeDefaultDescription
maxTreeDepthnumber50Maximum depth to traverse the component tree.
debugbooleanfalseEnable debug logging.

Subpath Exports