oxc-project/oxc · error · Error

Could not find the reuseWorker option in ${path}

Error message

Could not find the reuseWorker option in ${path}

What it means

Diagnostic from oxlint's vue/prefer-import-from-vue rule (crates/oxc_linter/src/rules/vue/prefer_import_from_vue.rs). It flags module specifiers `@vue/runtime-dom`, `@vue/runtime-core`, `@vue/reactivity`, and `@vue/shared`, telling you to import the same bindings from the public `vue` package instead. Those four are Vue's internal packages: their layouts change between releases and importing them directly breaks version alignment and tooling assumptions.

Source

Thrown at napi/disable-reused-workers.mjs:15

import fs from "node:fs";

const REUSED_WORKERS = "reuseWorker: { size: __asyncWorkPoolSize + __workerPoolSize },";
const DISABLED_REUSED_WORKERS = "reuseWorker: false,";

export function disableReusedWorkers(path) {
  let data = fs.readFileSync(path, "utf-8");

  // The pool is initialized eagerly, but browsers reject its worker URL when a binding is loaded
  // from a cross-origin CDN because workers must be loaded from the page's origin.
  if (data.includes(REUSED_WORKERS)) {
    data = data.replace(REUSED_WORKERS, DISABLED_REUSED_WORKERS);
    fs.writeFileSync(path, data);
  } else if (!data.includes(DISABLED_REUSED_WORKERS)) {
    throw new Error(`Could not find the reuseWorker option in ${path}`);
  }
}

View on GitHub (pinned to e1e7af627c)

Solutions

  1. Change the module specifier to 'vue' (run `oxlint --fix` to autofix all occurrences at once).
  2. Verify each named binding actually exists on the public 'vue' entry; replace or remove it if not.
  3. If internals are genuinely required, pin the Vue version and scope an oxlint-disable comment to that single import.

Example fix

// before
import { createApp } from '@vue/runtime-dom'
import { ref } from '@vue/reactivity'

// after
import { createApp, ref } from 'vue'
Defensive patterns

Strategy: validation

Validate before calling

// reject internal @vue/* specifiers before they reach review
const BAD = ['@vue/runtime-dom', '@vue/runtime-core', '@vue/reactivity', '@vue/shared'];
const fs = require('fs');
for (const f of jsFiles) {
  const src = fs.readFileSync(f, 'utf8');
  for (const m of BAD) {
    if (src.includes(`from '${m}'`) || src.includes(`from "${m}"`)) {
      throw new Error(`${f}: import from 'vue' instead of ${m}`);
    }
  }
}

Prevention

When it happens

Trigger: Any import declaration (`import { ref } from '@vue/reactivity'`), indirect re-export (`export { computed } from '@vue/runtime-core'`), or star re-export (`export * from '@vue/runtime-dom'`) whose module specifier is one of the four internal packages. The rule ships an auto-fix replacing the specifier with 'vue'. TypeScript definition files (.d.ts) are exempt, and `@vue/composition-api` (the Vue 2 plugin) is not flagged.

Common situations: Copy-pasting from Vue internals or internals-based blog posts; code written against Vue 2's @vue/composition-api that kept deep paths after upgrading; attempts to shrink bundles with deep imports; test utilities reaching into runtime internals.

Related errors


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