Skip to content

fix: undefined references arrays in prepare:types and nitro:prepare:types hooks cause runtime errors #33238

@hillaryke

Description

@hillaryke

Describe the bug

When running bun install or npm install in a Nuxt project, the build process fails with 'Cannot read properties of undefined (reading "push")' errors. This occurs in the prepare:types and nitro:prepare:types hooks when nodeReferences, sharedReferences, or references arrays are undefined during destructuring.

Steps to reproduce

  1. Clone or set up a Nuxt project.
  2. Add the dependency "@nuxtjs/kinde": "^0.3.0" to package.json
  3. Run bun install or npm install
  4. The installation fails with error: Cannot read properties of undefined (reading "push")

Expected behavior

Package installation should complete successfully without runtime errors.

Current behavior

Installation fails due to undefined reference arrays in the prepare:types hooks.

Additional context

This is a backward compatibility issue where the hooks don't provide default empty arrays, causing runtime errors when existing code tries to push to these arrays during the installation/build process.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions