Skip to content

[v4] 4.0.8 Vite plugin breaks if there are virtual imports like unfonts.css #16732

Closed
@octoper

Description

@octoper

What version of Tailwind CSS are you using?

For example: v4.0.8

What build tool (or framework if it abstracts the build tool) are you using?

For example: Vite v6.1.1

What version of Node.js are you using?

For example: v20.13.1

What browser are you using?

For example: Chrome

What operating system are you using?

For example: macOS

Reproduction URL

https://github.com/octoper/vitejs-tailwind408-repro

Describe your issue

When upgraded to @tailwindcss/vite to 4.0.8 I started seeing the error below, this seem to occur when I'm importing a virtual module unfonts.css coming from the https://github.com/cssninjaStudio/unplugin-fonts Vite plugin. Downgrading to 4.0.7 fixes the issue

node:internal/fs/promises:1028
  path = getValidatedPath(path);
         ^

TypeError [ERR_INVALID_ARG_VALUE]: The argument 'path' must be a string, Uint8Array, or URL without null bytes. Received '/Users/octoper/projects/vitejs-tailwind408-repro/\x00unfonts.css'
    at Object.stat (node:internal/fs/promises:1028:10)
    at C.addBuildDependency (file:///Users/octoper/projects/vitejs-tailwind408-repro/node_modules/@tailwindcss/vite/dist/index.mjs:1:5234)
    at C.generate (file:///Users/octoper/projects/vitejs-tailwind408-repro/node_modules/@tailwindcss/vite/dist/index.mjs:1:3810)
    at TransformPluginContext.transform (file:///Users/octoper/projects/vitejs-tailwind408-repro/node_modules/@tailwindcss/vite/dist/index.mjs:1:1967)
    at EnvironmentPluginContainer.transform (file:///Users/octoper/projects/vitejs-tailwind408-repro/node_modules/vite/dist/node/chunks/dep-Cg8OuIew.js:48466:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async loadAndTransform (file:///Users/octoper/projects/vitejs-tailwind408-repro/node_modules/vite/dist/node/chunks/dep-Cg8OuIew.js:42166:27) {
  code: 'ERR_INVALID_ARG_VALUE'
}

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