Skip to content

[Bug] Build fails in Astro v5.x: Cannot read properties of undefined (reading 'name') #1509

Open
@mxmason

Description

Describe the bug

As of Astro 5.0, this plugin breaks Vite builds. Non-Astro projects using Vite v6 build just fine, and downgrading to Astro@4 also works just fine. To reproduce:

  1. Clone the attached repo
  2. run npm ci
  3. run npm run build

Reproduction

https://github.com/mxmason/astro-vanilla-extract-bug

System Info

System:
    OS: macOS 15.1.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 95.75 MB / 32.00 GB
    Shell: 5.9 - /opt/homebrew/opt/zsh/bin/zsh
  Binaries:
    Node: 20.14.0 - ~/.fnm/node-versions/v20.14.0/installation/bin/node
    npm: 10.9.0 - ~/.fnm/node-versions/v20.14.0/installation/bin/npm
  Browsers:
    Chrome: 131.0.6778.87
    Safari: 18.1.1
    Safari Technology Preview: 18.2
  npmPackages:
    @vanilla-extract/css: ^1.16.1 => 1.16.1 
    @vanilla-extract/vite-plugin: ^4.0.18 => 4.0.18 
    astro: ^5.0.2 => 5.0.2

Used Package Manager

npm

Logs

Cannot read properties of undefined (reading 'name')
file: /user/dev/astro-vanilla-extract-bug/src/test.css.ts
  Stack trace:
    at TransformPluginContext.transform (file:///user/dev/astro-vanilla-extract-bug/node_modules/astro/dist/vite-plugin-astro/index.js:162:30)
    at loadAndTransform (file:///user/dev/astro-vanilla-extract-bug/node_modules/vite/dist/node/chunks/dep-CB_7IfJ-.js:51929:49)
    at async ViteNodeServer._fetchModule (file:///user/dev/astro-vanilla-extract-bug/node_modules/vite-node/dist/server.mjs:391:17)
    at async ViteNodeRunnerWithContext.cachedRequest (file:///user/dev/astro-vanilla-extract-bug/node_modules/vite-node/dist/client.mjs:189:14)
    at async /user/dev/astro-vanilla-extract-bug/node_modules/@vanilla-extract/integration/dist/vanilla-extract-integration.cjs.prod.js:807:29

Validations

Metadata

Assignees

No one assigned

    Labels

    integrationIssue related to the integration package, potentially affects multiple pluginsupstream issueIssue caused by a required upstream dependencyviteIssue related to vite

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions