oxc-project/oxc · warning
out of memory
Error message
out of memory
What it means
The companion diagnostic of oxlint's vue/require-default-export rule (crates/oxc_linter/src/rules/vue/require_default_export.rs). It fires when a `.vue` file's plain `<script>` block calls `defineComponent(...)` or `Vue.component(...)` — creating a real component — but never default-exports it. Because a component object clearly exists, the rule reports the more specific 'Component must be the default export.' instead of the generic message; such SFCs render nothing in Vue 3.
Source
Thrown at crates/oxc_allocator/src/arena/utils.rs:112
debug_assert!(divisor.is_power_of_two());
unsafe {
let addr = ptr.addr().get();
let aligned = round_up_to_unchecked(addr, divisor);
let delta = aligned - addr;
ptr.add(delta)
}
}
/// Wrapper around `Layout::from_size_align` that adds debug assertions.
#[inline]
pub fn layout_from_size_align(size: usize, align: usize) -> Result<Layout, AllocErr> {
Layout::from_size_align(size, align).map_err(|_| AllocErr)
}
#[inline(never)]
#[cold]
pub fn oom() -> ! {
panic!("out of memory")
}
View on GitHub (pinned to e1e7af627c)
Solutions
- Change the named export to `export default defineComponent({...})`.
- If a named export is also needed, keep `const c = defineComponent({...}); export default c;` — the default export satisfies the rule.
- For Vue.component registration code, prefer the SFC default export and register via app.component elsewhere.
Example fix
// before
<script>
import { defineComponent } from 'vue';
export const component = defineComponent({ /* ... */ });
</script>
// after
<script>
import { defineComponent } from 'vue';
export default defineComponent({ /* ... */ });
</script> Defensive patterns
Strategy: validation
Validate before calling
// flag defineComponent/Vue.component without a default export in a plain <script>
const m = sfc.match(/<script(?![^>]*setup)[^>]*>([\s\S]*?)<\/script>/);
if (m && /\bdefineComponent\s*\(|\bVue\.component\s*\(/.test(m[1]) && !m[1].includes('export default')) {
throw new Error('component must be the default export');
} Prevention
- Default-export the component in every .vue file; reserve named exports for .ts modules.
- Write `export default defineComponent({...})` as the final statement of the script block.
- Enable vue/require-default-export in CI to catch codemod regressions.
When it happens
Trigger: Patterns like `export const component = defineComponent({})` (named export instead of default) or `const component = Vue.component('foo', {})` with no export — in a .vue file with a plain `<script>`, no default export in the module record, and no `<script setup>` block.
Common situations: Teams habitually using named exports; extracting the component into a variable before exporting; migrating from Vue 2 global registration (Vue.component) to SFCs; codemods rewriting `export default` to `export const`.
Related errors
- `VirtualFree` failed: {err}
- Tried to get an allocator from an empty `FixedSizeAllocatorP
- Change to `throw new TypeError(...)`
- Could not find the reuseWorker option in ${path}
- `VirtualFree` failed during cleanup: {err}
AI-assisted analysis of oxc-project/oxc@e1e7af627c (2026-08-20).
Data as JSON: /api/errors/f749ba5a10566770.
Report an issue: GitHub.