Skip to content

v4 upgrader removing the content of all files in my project #18972

@nexxai

Description

@nexxai

What version of Tailwind CSS are you using?

⚡️? 78% ➜ npx @tailwindcss/upgrade --version
≈ tailwindcss v4.1.13

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

Vite: 6.3.6

What version of Node.js are you using?

For example: v21.7.3

What browser are you using?

n/a

What operating system are you using?

macOS Tahoe 26.0

Reproduction URL

This is not a rendering issue, it's a problem with the @tailwindcss/upgrade package, so I'm not sure how to provide a "reproduction" but happy to do so if someone can explain.

Describe your issue

I realize this is going to sound crazy, but I swear it's happening and I can't figure out why. When I run `npx @tailwindcss/upgrade" to upgrade my app from v3 to v4, it deletes every file in my project tree. Not just CSS files, but literally every file.

Specifically, it happens during the "Migrating templates..." step. Originally, it looked like it was hung, but when I killed the process, I checked my git tree and thousands of files had been deleted. Thankfully, I had run a commit right before I ran the updater so I could revert without issue, but I suspect this is not expected behaviour.

In this example, I show that there are no changes to be made, I run the upgrader, and then it's showing all of these files having been deleted (it would delete more if I didn't CTRL-C out of the upgrader).

2:36:03 PM in ipms on  filament-v4-upgrade via 🥟 v1.2.22 via  v8.4.12
⚡️? 78% ➜ git status
On branch filament-v4-upgrade
nothing to commit, working tree clean

2:36:05 PM in ipms on  filament-v4-upgrade via 🥟 v1.2.22 via  v8.4.12
⚡️? 78% ➜ npx @tailwindcss/upgrade
≈ tailwindcss v4.1.13

│ Searching for CSS files in the current directory and its subdirectories…

│ Migrating stylesheets…

│ ↳ Migrated stylesheet: `./resources/css/app.css`

│ Updating dependencies…

│ ↳ Updated package: `tailwindcss`

│ ↳ Updated package: `@tailwindcss/postcss`

│ ↳ Updated package: `@tailwindcss/vite`

│ ↳ Updated package: `prettier-plugin-tailwindcss`

│ Migrating templates…

^C

2:36:17 PM in ipms on  filament-v4-upgrade [!] via 🥟 v1.2.22 via  v8.4.12 took 8s
⚡️? 78% ➜ git status
On branch filament-v4-upgrade
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   .editorconfig
        modified:   README.md
        modified:   _ide_helper_models.php
        modified:   app/Casts/Markdown.php
        modified:   app/Console/Commands/AddDuesToAllCommand.php
        modified:   app/Console/Commands/AddInstructionalVideosCommand.php
        modified:   app/Console/Commands/ImportContest2024Command.php
        modified:   app/Console/Commands/ImportMembersCommand.php
        modified:   app/Console/Commands/MigrateDbEngineCommand.php
        modified:   app/Enums/ClassifiedAdContactType.php
        modified:   app/Enums/ClassifiedAdType.php
        modified:   app/Enums/Config/DuesFrequency.php
        modified:   app/Enums/ContestEntryAgeClass.php
        modified:   app/Enums/ContestEntryRanking.php
        modified:   app/Enums/ExternalMembershipOrganization.php
        modified:   app/Enums/InstructionalVideoPanel.php

no changes added to commit (use "git add" and/or "git commit -a")

2:36:19 PM in ipms on  filament-v4-upgrade [!] via 🥟 v1.2.22 via  v8.4.12
⚡️? 78% ➜

I'm not really sure what else to do. I tried downloading and compiling the package myself to try and understand why it's even thinking it should touch any non-CSS file but I'm getting this error when I try to pnpm run build the main tailwindcss project:

error[E0463]: can't find crate for `std`
  |
  = note: the `wasm32-wasip1-threads` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-wasip1-threads`

even though I've already confirmed that target is installed:

⚡️? 78% ➜ rustup target add wasm32-wasip1-threads
info: component 'rust-std' for target 'wasm32-wasip1-threads' is up to date

Any help would be greatly appreciated. Thanks!

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