Skip to content

[unocss/vite] Dist-Chunk mode no longer works with vite 6.3 #4597

@jimmy-sc

Description

@jimmy-sc

UnoCSS version

v66.1.0-beta.11

Describe the bug

With vite version 6.3 the dist-chunk mode no longer works. Vite build gives the following error message:

> vite build

vite v6.3.0 building for production...
✓ 576 modules transformed.
[unocss] writing css to main-!~{004}~.js.css { handler: [AsyncFunction: handler] }
✗ Build failed in 947ms
error during build:
[unocss:chunk] cssPlugin.transform is not a function...

This seems to be happening due to the api change from this commit introduced in vite 6.3:
vitejs/vite#19586

I am not sure if anything is affected by this. For the dist-chunk mode I guess the only change needed, is to call the transform hook in the chunk-build.ts like this

 await cssPlugin!.transform.handler(css, fakeCssId)

Reproduction

Use dist-chunk mode and try to build with vite version 6.3

System Info

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions