Skip to content

Vite 8.0.0-beta.9 fails doing analyze of build in nuxt when using @nuxt/fonts #576

@joaopedrodcf

Description

@joaopedrodcf

Describe the bug

When using the Vite 8.0.0-beta.9 and doing a analyze on nuxt it breaks with the following error ( this was working on version 8.0.0-beta.8 and also doens't break if I use it alognside rolldown rc 1 by overriding )

The versions of nuxt: 4.2.1 , @nuxt/fonts: 0.12.1

By removing @nuxt/fonts the bundle analyze works.

I tried to create a similar example but the error it never shows the same error logs, but it still failed to run the analyze in stackbliz even if with a different output

ERROR  Build failed with 1 error:                                                                        

[plugin nuxt:fonts:font-family-injection]
TypeError: Cannot redefine property: viteMetadata
    at Function.defineProperty (<anonymous>)
    at injectChunkMetadata (file:///Users/user-name/projects/project-name/node_modules/vite/dist/node/chunks/node.js:34619:9)
    at PluginContextImpl.handler (file:///Users/user-name/projects/project-name/node_modules/vite/dist/node/chunks/node.js:34608:75)
    at PluginContextImpl.handler (file:///Users/user-name/projects/project-name/node_modules/vite/dist/node/chunks/node.js:34610:13)
    at plugin (file:///Users/user-name/projects/project-name/node_modules/rolldown/dist/shared/bindingify-input-options-Cb-01HR1.mjs:1373:18)
    at plugin.<computed> (file:///Users/user-name/projects/project-name/node_modules/rolldown/dist/shared/bindingify-input-options-Cb-01HR1.mjs:1652:18)

    at aggregateBindingErrorsIntoJsError (/Users/user-name/projects/project-name/node_modules/rolldown/dist/shared/bindingify-input-options-Cb-01HR1.mjs:621:18)
    at unwrapBindingResult (/Users/user-name/projects/project-name/node_modules/rolldown/dist/shared/bindingify-input-options-Cb-01HR1.mjs:591:128)
    at #build (/Users/user-name/projects/project-name/node_modules/rolldown/dist/shared/rolldown-build-KB1YaNe-.mjs:2360:34)
    at async buildEnvironment (/Users/user-name/projects/project-name/node_modules/vite/dist/node/chunks/node.js:34375:64)
    at async Object.build (/Users/user-name/projects/project-name/node_modules/vite/dist/node/chunks/node.js:34774:19)
    at async buildServer (/Users/user-name/projects/project-name/node_modules/@nuxt/vite-builder/dist/index.mjs:1480:5)
    at async handleSerialBuilds (/Users/user-name/projects/project-name/node_modules/@nuxt/vite-builder/dist/index.mjs:2285:3)
    at async bundle (/Users/user-name/projects/project-name/node_modules/@nuxt/vite-builder/dist/index.mjs:2251:5)
    at async bundle (/Users/user-name/projects/project-name/node_modules/nuxt/dist/index.mjs:6929:5)
    at async build (/Users/user-name/projects/project-name/node_modules/nuxt/dist/index.mjs:6789:3)
    at async Object.run (/Users/user-name/projects/project-name/node_modules/nuxt/node_modules/@nuxt/cli/dist/analyze-BckIrOKp.mjs:790:3)
    at async runCommand (/Users/user-name/projects/project-name/node_modules/citty/dist/index.mjs:316:16)
    at async runCommand (/Users/user-name/projects/project-name/node_modules/citty/dist/index.mjs:307:11)
    at async runMain (/Users/user-name/projects/project-name/node_modules/citty/dist/index.mjs:445:7)

Reproduction

https://stackblitz.com/edit/github-twku5qx1

Steps to reproduce

Run npm i and after npm run analyze the error is not the same as the one in the description but in this minimal reproduction it also fails for a different reason

Image

System Info

System:
    OS: macOS 26.2
    CPU: (11) arm64 Apple M3 Pro
    Memory: 320.88 MB / 36.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.21.1 - /Users/user-name/.local/state/fnm_multishells/94331_1769097078038/bin/node
    Yarn: 4.12.0 - /Users/user-name/.local/state/fnm_multishells/94331_1769097078038/bin/yarn
    npm: 10.9.4 - /Users/user-name/.local/state/fnm_multishells/94331_1769097078038/bin/npm
    bun: 1.1.38 - /opt/homebrew/bin/bun
  Browsers:
    Brave Browser: 144.1.86.139
    Chrome: 144.0.7559.97
    Firefox Developer Edition: 147.0
    Safari: 26.2

Used Package Manager

yarn

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions