feat(vite): add support for Vite 8#34850
Conversation
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
👷 Deploy request for nx-dev pending review.Visit the deploys page to approve it
|
|
Hi team! The Vercel deployment check is showing as failed, but this PR only touches files in Also, the Netlify deploy previews are pending review (expected for fork PRs). Thanks! |
|
View your CI Pipeline Execution ↗ for commit 2090b20
☁️ Nx Cloud last updated this comment at |
bcf6844 to
6abd70f
Compare
6abd70f to
0478f45
Compare
|
Hi @rsidzinkaloopme , thanks for the PR. I'll check on the CI blocker. |
d343386 to
9e42add
Compare
|
Hi @jaysoo I was trying to add support for Vite 8, but I think it requires more effort than I initially though, because Vite 8 started using rolldown, currently I don't have time to work on this issue, hope someone can pick this up. |
|
@rsidzinkaloopme I'll update this PR so we can release it in a patch release. It'll handle the peer dep changes, and any potential fork in logic we need for Vite 8 and prior versions. In a follow-up PR we will do the migrate/package update, AI migrations, etc. needed to bring everyone to Vite 8. |
6c39dd3 to
98faec5
Compare
a6b103d to
4bea10b
Compare
4bea10b to
5f03973
Compare
5f03973 to
742f28f
Compare
8851d84 to
074ceb8
Compare
20dc607 to
90e914e
Compare
e0c9ea6 to
f948969
Compare
The `@nx/vite` plugin only supports Vite 5, 6, and 7. Add Vite 8 support: - Update peer deps to include ^8.0.0 - Bump @vitejs/plugin-react to ^6.0.0 (Vite 8 compat) - Handle rolldownOptions alongside rollupOptions (Vite 8 renamed rollup to rolldown) - Fix build executor environments API to preserve env-specific config - Add useViteV7 flag for backward compatibility - Fix type imports for Vite 8's ESM-only .d.mts declarations - Add e2e tests for both Vite 7 and Vite 8 React apps - Update docs to list ^8.0.0 as supported Fixes nrwl#34849
f948969 to
2090b20
Compare
There was a problem hiding this comment.
Nx Cloud has identified a flaky task in your failed CI:
Since the failure was identified as flaky, the solution is to rerun CI. Because this branch comes from a fork, it is not possible for us to push directly, but you can rerun by pushing an empty commit:
git commit --allow-empty -m "chore: trigger rerun"
git push
🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.
🎓 Learn more about Self-Healing CI on nx.dev
Current Behavior
The
@nx/viteplugin only supports Vite 5, 6, and 7. Users on Vite 8 get peer dependency errors:Expected Behavior
Full Vite 8 support for new and existing workspaces:
Nx plugin support:
^8.0.0in@nx/viteand@nx/vitestviteVersion = '^8.0.0')@vitejs/plugin-reactto^6.0.0(required for Vite 8, uses Oxc instead of Babel)useViteV7backward compatibility flag (follows existinguseViteV5/useViteV6pattern)Rolldown migration (Vite 8 replaced Rollup with Rolldown):
rollupOptions(Vite <8) androlldownOptions(Vite >=8) in build executor and plugin detectionrolldownOptionsconfigType fixes for Vite 8's ESM-only declarations:
.d.mtstype declarations not resolvable undermoduleResolution: "node"typeof import('vite')andimport typeusages across@nx/vite,@nx/vitest,@nx/cypress,@nx/react,@nx/angular,@nx/remixwith inline castsTODO(jack)comments to remove when switching tomoduleResolution: "nodenext"Plugin compatibility:
@vitejs/plugin-react@^6.0.0only supports Vite 8;^4.2.0for Vite <=7ensure-dependenciesdetects installed vite version and picks the correct plugin-react versionAngular vitest fix:
@angular/builddepends onrolldownwhich injects@oxc-project/runtimehelpers at transform time without declaring it as a dependency@oxc-project/runtimeas an explicit devDependency in the Angular vitest generatorDocs:
^8.0.0rolldownOptions.inputto buildable project detection docsE2E coverage:
rolldownOptionsOther notes
We'll do a follow-up PR to include migrations for 22.7.0. This PR's scope is only to ensure peer deps and our generators work for workspaces that are already using Vite 8.
Related Issue(s)
Fixes #34849